This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have tomcat installed on my laptop. Now I am trying to understand taglib. So I checked almost all the folders under tomcat and found "jstl" in the following path
jstl is jar file, I opened it with winzip and I found few classes organized in different folders placed in a hierarchy e.g. one class is "ConditionalTagSupport.class". Do these classes represent tags ? If yes then How to use these tags ? How do I know what does this tag do ?
If its not tags, then where can I find some sample tags ? Are there readymade tags library available or all the libraries are custom made by organizations ? Is it proprietory information ? Is there any sample tag library available to work with ?
Definitely Google and check the JavaDocs for the JSTL taglibs.
But basically, here's how it works. A tag library provides a set of custom tags that perform some type of function. I just finished a blog about using some basic JSF tags in a simple web page.(My JSF Blog) Tags in a JSF page look like this:
Here you have an outputLink tag, an outputText tag and view tag. Now, those look like HTML/XML type elements, but they provide some logic and functionality, and that functionality is written in Java. So, while the developer who uses the tag is shielded from the implementation, the fact is, there is definitely a Java class somewhere that provides the implementation of those tags. So, yes, the code you saw in the JSTL library was probably the implementation of a particular tag. However, that's not where you want to go to find out about how to use the tag. As a web developer, you just want to focus on the tag.
Joined: Apr 16, 2009
thanks. Thats the logic I was applying.
Question is, how do I know which tag does what ? If I want to use an API, I can refer to the documentation on java.sun.com and find the details of API. These APIs are available to anyone who wants to use it.
Where can I find documentation for the taglib ? Are they available to everyone ?
The tags you used in the example you gave, if I want to use those tags what do I need to do ?
I have no idea where to start from for the use of taglib. Can you please explain where to start ?
nirali shah wrote:Where can I find documentation for the taglib ? Are they available to everyone ?
If you are asking specifically about the JSTL tags, then I've already told where to look for their documentation. For anybody else's tags, it's the responsibility of the author of the tag library to make documentation available.
A properly documented tag library (rare) can be passed through the tlddoc tool to produce Javadoc-like documentation from the documentation markup in the TLD file.
To learn how to write your own tags and libraries, start with the JSP Specification.
Joined: Apr 16, 2009
how to find what taglibs are made public by the author ? How to find them ? Is there any centralised store there to store the taglibs like APIs are available online through java.sun.com ?
You replied earlier to check JSTL sprcification. Can you please tell where and how ? Is there any command line tool to check jstl specification like javadoc ?
I did visit the link provided by you, but I am still unable to figure out. That link directed to other link.
I visited java.sun.com. In that I looked for taglib and I found that java WSDP is having a taglib as a part of the package. Now this java WSDP and jdk are one and same or different ?
To download taglib alone, I visited brothersoft.com and downloaded a package from there. There were few tags like NextPageButtonTag, NewPaneTag etc. But I could not figure out how to use these tags. I could not find and specification document mentioning how to use these tags.
Can someone please provide detailed answer to my problem rather than being brief and directing to other sites please.