| Author |
Custom tags ch8 vs. EL functions ch9
|
Jamed
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 jamed
|
 |
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> <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
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 />---------------------
|
 |
 |
|
|
subject: Custom tags ch8 vs. EL functions ch9
|
|
|