Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Custom tags ch8 vs. EL functions ch9

 
Jamed
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hallo everyone

i am confused !

What is the difference between EL functions described on chapter 8 of HFSJ and custom tags described in chapter 9 ?

how would i distiguish need for each?

thanks in advance

jamed
 
Kedar Dravid
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EL functions MUST be public and static.
Also, the web.xml entries for these 2 types are distinct.
Also, custom tags come in two flavours:
The Classical custom tags model and the Simple tags model.

EL function DD entry:
<function>
<name>XX</name>
<function-class>zzz.yyy</function class>
<function-signature>java.lang String XX(java.lang.String)</function-signature>
</function>

Custom tag DD entry:
<tag>
<name>greet</tag>
<tag-class>ddd.eee</tag-class>
<attribute>
<name>user</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>

BTW, custom tags are far more versatile than EL functions.
 
Anand Wadhwani
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correct!! EL functions are more or less utility functions (being static) "http-unaware" POJ (Plain old java) where as custom tags (SimpleTagSupport / TagSupport / BodyTagSupport) are stateful "http-aware" objects and can be used as more versatile perspective.

By "http-aware" I mean the objects have access to JSP implicit objects. The custom tag class can access all implicit objects like request, response etc by using context (JspContext / PageContext) but EL functions cannot. They can actually but the objects would have to be passed as function parameter since functions are static and do not asscociate any object.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic