Re: Is it possible to create a custom JSTL function using a tag file

Stuart Thiel <[email protected]> Mon, 12 Oct 2009 15:04:41 -0400
Newsgroups gmane.comp.jakarta.taglibs.user
Message-ID <[email protected]>
Hello Marcel,

If I understand you correctly, then it is not exactly possible to do 
what you'd like.

More specifically, I believe you're talking about making an EL function 
(vs. JSTL which is a set of third party tags/functions). You can use any 
public static method in any class for this, so it doesn't need to be 
special in any way, but you do need to define it in a tag library so 
that a JSP page knows how to find it. You can isolate a bunch of your 
utility EL functions in their own tag library with their own prefix to 
avoid polluting your main tag libraries, but I would generally organize 
by cohesion instead (putting related tags and functions together in the 
same tag libraries, following the same approach one might do with OO 
class creation).

I haven't read all of this, but skimming it seemed to satisfy me that 
the basics are covered:
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro7.html

Stuart

Marcel Overdijk wrote:
> I'm wondering  if it is possible to create a custom JSTL function using a tag
> file (so not using a tld and tag class).
>
> Any reference to an example would be helpful.
>
>
> Cheers,
> Marcel
>