Help coderanch get a
new server
by contributing to the fundraiser
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Tag Files Packaged in JAR files.

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ???
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 :
 
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ???
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
did you resolve this problem ? am getting the same exception.
 
Kamal Tripathi
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
nope I was not able to.
 
nisha chidella
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh ..its working for me now. i just forgot to restart the server after deploying the jar file.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic