You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Marcel Overdijk <ma...@gmail.com> on 2009/10/12 20:58:06 UTC

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

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
-- 
View this message in context: http://www.nabble.com/Is-it-possible-to-create-a-custom-JSTL-function-using-a-tag-file-tp25861181p25861181.html
Sent from the Taglibs - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@tomcat.apache.org
For additional commands, e-mail: taglibs-user-help@tomcat.apache.org


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

Posted by Henri Yandell <fl...@gmail.com>.
Was hoping people would overlook that typo :)

I meant custom EL function.

Hopefully there will also be some tag flies in the Extended Taglib,
definitely seems a nicer way to write than in Java, but I've not
written many in anger so not sure of any surprises.

Hen

On Mon, Oct 12, 2009 at 2:10 PM, Stuart Thiel <st...@gmail.com> wrote:
> Ahhh, tag files is something I hadn't head of before. This example shows a
> simple one being used:
> http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPTags5.html
>
> I'm still not sure what you meant by "custom JSTL function", though.
>
>
> Henri Yandell wrote:
>>
>> The following is an example btw:
>>
>> http://svn.apache.org/repos/asf/tomcat/taglibs/extended/trunk/
>>
>> Currnetly it exposes various Commons Lang functions to JSTL using tag
>> functions.
>>
>> Hen
>>
>> On Mon, Oct 12, 2009 at 12:04 PM, Stuart Thiel <st...@gmail.com>
>> wrote:
>>
>>>
>>> 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
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: taglibs-user-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: taglibs-user-help@tomcat.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: taglibs-user-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: taglibs-user-help@tomcat.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: taglibs-user-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@tomcat.apache.org
For additional commands, e-mail: taglibs-user-help@tomcat.apache.org


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

Posted by Stuart Thiel <st...@gmail.com>.
Ahhh, tag files is something I hadn't head of before. This example shows 
a simple one being used:
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPTags5.html

I'm still not sure what you meant by "custom JSTL function", though.


Henri Yandell wrote:
> The following is an example btw:
>
> http://svn.apache.org/repos/asf/tomcat/taglibs/extended/trunk/
>
> Currnetly it exposes various Commons Lang functions to JSTL using tag functions.
>
> Hen
>
> On Mon, Oct 12, 2009 at 12:04 PM, Stuart Thiel <st...@gmail.com> wrote:
>   
>> 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
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: taglibs-user-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: taglibs-user-help@tomcat.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: taglibs-user-help@tomcat.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@tomcat.apache.org
For additional commands, e-mail: taglibs-user-help@tomcat.apache.org


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

Posted by Henri Yandell <fl...@gmail.com>.
The following is an example btw:

http://svn.apache.org/repos/asf/tomcat/taglibs/extended/trunk/

Currnetly it exposes various Commons Lang functions to JSTL using tag functions.

Hen

On Mon, Oct 12, 2009 at 12:04 PM, Stuart Thiel <st...@gmail.com> wrote:
> 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
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: taglibs-user-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@tomcat.apache.org
For additional commands, e-mail: taglibs-user-help@tomcat.apache.org


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

Posted by Stuart Thiel <st...@gmail.com>.
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
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@tomcat.apache.org
For additional commands, e-mail: taglibs-user-help@tomcat.apache.org