• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Keeping all these tags straight...

 
Ryan Day
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going through the HFSJSP book ch. 8, 9, 10, and I'm having trouble keeping all these things straight. Does someone know an easy way to remember what the difference is, and why they're all needed?

EL functions
standard actions - <jsp:
JSTL tags - <c:, etc
tag FILES
custom tag libraries

Thanks!
 
Micheal John
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EL Functions - your utility/helper class can be written as separate Java file and can be called from the JSP thru EL

EL - To avoid using Scripts (expression, declaration, scriptlet)

standard action: how will you get/set the attribute without scripts..? You can use the standard action to set/get the attributes, which can be used in the EL, since EL don't allow the scripts(expression, declaration, scriptlet)

JSTL : some of the tags, which have written already for readymade use(libraries).. for example:if you want to use for loop, if loop, switch case.. for things like this, you can use JSTL

custom tag: when JSTL is not enough/you want to do your custom/own things..you can write your own tags..

tag files: pls go thru' the link given below. This link is not only for tag files, but for the entire JSP2.0 features..

http://www.oracle.com/technology/sample_code/tutorials/jsp20/tagfiles.html
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The easiest way to remember them is to use them. This is a little more time-consuming than rote memorization but they will be very easy to remember if you get this practice.

You could start with <c and <jsp tags, using them to display a collection of JavaBeans (the beans could represent cars, movies, or something else you like). Once you have those down, the usefulness of a tag file or custom taglib will also become less obtuse.
 
Ryan Day
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys
 
Ryan Day
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK going through this a second time, I still wonder about EL functions. Why would you use these instead of custom tags?
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've wondered that a lot myself.

One advantage is that you could use an EL function inside the attribute of a tag, whereas a tag typically can't be placed inside the attribute of another tag.
 
Ryan Day
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More info on my original question (as I get it all straight for myself). Here's a quote from HFSJ p. 502:
"(a custom tag file) is a little like an EL function, except much more powerful and flexible. Where EL functions are nothing more than static methods, a tag handler class has access to tag attributes, the tag body, and even the page context so it can get scoped attributes and the request and response"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic