This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tag Files Packaged in JAR files.

 
Kamal Tripathi
Ranch Hand
Posts: 86
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an application "sample"

To test example of TAG files packaged in JAR file, I created /result.jsp





Next I know that TAG file has to be placed in META-INF/tags So I created META-INF folder separately and in META-INF/tags I created

MoreFooter.tag


Next I created META-INF/TLDs, I created metaTag.tld



MANIFEST.MF

Next I created a jar (sample-tld.jar) of this META-INF folder and copied to /sample/WEB-INF/lib.



sample-tld.jar structure

--------tags
----------------MoreFooter.tag
--------TLDs
----------------metaTag.tld
--------MANIFEST.MF


Webapp sample structure

--------result.jsp
--------WEB-INF
----------------lib
------------------------sample-tld.jar
--------META-INF
----------------MANIFEST.MF




Now there are some support servlets which forward my request to this JSP. They are working fine. But when I hit it. This is the output

TRYING TAG FILES
DISPLAYING SOME FOOTER THRU TAG FILES in META-INF. ULTIMATE!!!



But for second line of output I expected it to come out in some color followed by "THIS IS IN META-INF ONCE MORE:"

It seems container is not able to associate "comtags" URI with MoreFooter.tag in the jar.

The only thing I can think of is I might have to put something in the JSP to relate the URI to TAG file.

but

<%@ taglib prefix="comtags" uri="/META-INF/tags" %> doesn't work since it says File "/META-INF/tags" not found

<%@ taglib prefix="comtags" tagdir="/META-INF/tags" %> doesn't work since it says that tagdir should start with /WEB-INF/tags

What am I doing wrong here ???
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sample-tld.jar structure

Where is META-INF ? META-INF and its subdirectories should be in the JAR file.

<uri>comtags</uri>

You should use this uri to access your library :
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
uri>comtags</uri>

You should use this uri to access your library :
view plaincopy to clipboardprint?
<%@ taglib prefix="comtags" uri="comtags" %>




We need to use tagdir while using tagfiles. but as you deploy your tagfiles as a jar within lib folder, you have to use "uri" attribute corresponde to the <uri></uri> element of the TLD file.
Moreover as Cristophe already mentions it. you need to put these files in the META-INF (TLD files AND tag files) folder wirhin simpleTag.jar file. Every .jar has its own META-INF folder inside it.


 
Kamal Tripathi
Ranch Hand
Posts: 86
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I didn't put up the sample-tld.jar structure correctly. I missed out on mentioning META-INF. All the contents are inside META-INF. So this is the correct structure.


sample-tld.jar structure

--------META-INF
----------------MANIFEST.MF
----------------tags
------------------------MoreFooter.tag
----------------TLDs
------------------------metaTag.tld

You should use this uri to access your library :



But I didn't have this line in my jsp. (Didn't know that when tag files are packages in jar files you have to use uri attribute instead of tagidr). So now my jsp reads as




But now I am getting error as



I am wondering if I have to declare anything in sample-tld.jar/META-INF/META-INF.MF ???
 
nisha chidella
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you resolve this problem ? am getting the same exception.
 
Kamal Tripathi
Ranch Hand
Posts: 86
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nope I was not able to.
 
nisha chidella
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh ..its working for me now. i just forgot to restart the server after deploying the jar file.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic