I put the tag file into a jar file using the command "jar cvf tagfile.jar ." I issued this command from the directory that contains META-INF\tags\field.tag. After the command i got the jar file which i placed in WEB-INF\lib
Since this tag file is a part of a jar file, I placed a tag in my TLD as follows:
When I try to access the jartagfile.jsp, I am getting the following exception:
Can anyone tell me whats the problem and how can i resolve it?
I was wondering if the directive I added in my JSP for the tag file is correct or not.
I read that we must provide the location of the tagfile in the "tagdir" attribute of the directive. Is the way, I have done, the correct way of mentioning the location of the tag file? I mean, how do you indicate the location of a tag file which is inside a jar file?
Originally posted by Dinkar Chaturvedi: I was wondering if the directive I added in my JSP for the tag file is correct or not.
Of course it's not. That directive is telling the container to look in the WEB-INF/tags folder of the web app, and the tag's not there.
Within the TLD file of the tag library, you would declare the tag like this example:
Note that you can create sub-folders under META-INF. Then place the tag file in the META-INF/whatever folder within the jar file.
Now here's the part that you might be missing: the TLD file for the jarred tag must be within the jar file itself in the META-INF folder.
This way, you can create jar files that are self-contained tag libraries, where there's no need to do anything but drop the jar file (or files as in the case of the JSTL) into the WEB-INF/lib, and then use the appropriate tag declaration on the pages.
You cannot reference the jarred tag file from a TLD that is not in the jar file. [ April 06, 2007: Message edited by: Bear Bibeault ]