• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Custom tags ch8 vs. EL functions ch9

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic