Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

"tld" file,"tag" file and "cutsom tag"

 
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry but i am confused among "tld" file,"tag" file and "custom tag".
Please clarify the difference between all these 3 types/files and when to use which file.

~ Abhay
 
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These all are different but tries to serve the same purpose to have custom user defined components/functionality.

tag files are jsp files which contains fragment of code which can be used anywhere within any other jsp file.

custom tag and tld files are used to define and give configurations about the custom component made by user using interfaces.

You can give a try and read about them. I am proving some links for you.

http://today.java.net/pub/a/today/2003/11/14/tagfiles.html

http://java.sun.com/developer/technicalArticles/xml/WebAppDev3/

HTH

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Abhay Agarwal wrote:I am sorry but i am confused among "tld" file,"tag" file and "custom tag".
Please clarify the difference between all these 3 types/files and when to use which file.

~ Abhay



To understand these terms, you need to learn the concept behind tags and their libraries. What are they, and why are they used ?
Tags are defined in TDL files.
To give you a start, tags and their libraries reduce the clutter in JSP pages by putting more readable xml tags rather than scriptlets .
For example, I find prettier than
Do you?

If you concur with me, then lets start by defining own custom tag libraries
(The tag used in the example is that of JSTL core taglib, something Java Engineers have done for us already).
Follow the next steps :
1. First, we define a xml file known by the extension .tld(tag library descriptor).
In this file, we define the structure of our tag, its attributes etc.
2. We put this tld somewhere under WEB-INF and then write Java code to support this tld file.
We compile that code and put it in a place where the Server can find it at runtime (usually WEB-INF/lib)
Therefore, we have moved our Java code from ugly scriptlets in JSP to somewhere in Servlet (remember that all JSPs are compiled into Servlet).
3. Next, we just refer to this .tld from our JSPs specifying its location and giving it a prefix.
That's it! You are free to use your custom tag now. In essence at least. To learn more you will have to explore on your own.

One more thing: Apart from JSTL taglibs and custom taglibs, there are also 3rd party taglibs like the Display Tag that you might find useful.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a post here which I think answers your question exactly (eg. what is the difference between tlds, tag files and custom tags".

http://blog.idleworx.com/2010/04/custom-tags-tld-tag-files-el-functions.html
 
I claim this furniture in the name of The Ottoman Empire! You can keep this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic