Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between tag and tld

 
rehans oberoi
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anyone tell me the difference between tag and tld
 
lalit upadheyay
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A Tag Library Discriptor(TLD) is an XML like file (like web.xml) used to describe the functions(EL) and tags provided by a user defined tag library.

The tag is the actual element that performs some customizable functionality through its attributes (like <jsp:setproperty>, is used to set property of a java bean) in a JSP file.

I hope that this explains the basic difference though the topic has many other things to be learnt.
 
lalit upadheyay
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry. I cited wrong example for tag. The example i have specified is a standard action. Example of tags in Java Standarad Tag Libraries(JSTL) are <c:if>,<c:forTokens>,<c:forEach>,<c:include>. We only need to learn the tags in core library (nearly 13 tags).
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
isn't rehans talking about tag files ? (*.tag, *.tagx)
 
sriRam gaddaM
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
talking about tag files,

tag files are an advancement to custom tag libraries

custom tags are in version JSP1.x ..they are nothing but java classes which implement inerfaces like tag, iterationTag, bodyTag..it is a little industrious way of writing tags. In custom tag libs, you have to provide implementation for setter methods methods like setPageContext, setParent, doStartTag, doEndTag, release etc.,

tag files do away with all these methods....they are not even written as classes..they are newly added in JSP 2.0 to reduce the code...they are saved as .tag files... the body of tag files contains JSP code...and you can also use custom tags like JSTL 2.0 inside the body...

hope I am clear,
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

the body of tag files contains JSP code


The most significant aspect to note here is both tag files and simple tag's body cannot have scripting code
 
Sub swamy
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As per HFSJ, body of tag files cannot have scripting, however tag files can have scripting.

Don't find any errata related to this as well.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic