The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Custom tags ch8 vs. EL functions  ch9 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Custom tags ch8 vs. EL functions  ch9" Watch "Custom tags ch8 vs. EL functions  ch9" New topic

Custom tags ch8 vs. EL functions ch9

Ranch Hand

Joined: Apr 17, 2005
Posts: 35
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

Kedar Dravid
Ranch Hand

Joined: May 28, 2004
Posts: 333
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-class>zzz.yyy</function class>
<function-signature>java.lang String XX(java.lang.String)</function-signature>

Custom tag DD entry:

BTW, custom tags are far more versatile than EL functions.
Anand Wadhwani
Ranch Hand

Joined: Mar 21, 2005
Posts: 151
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.

SCWCD 1.4<br />---------------------<br />Ability is what you're capable of. <br />Motivation determines what you do. <br />Attitude determines how well you do it.<br />---------------------
I agree. Here's the link:
subject: Custom tags ch8 vs. EL functions ch9
It's not a secret anymore!