• 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Tag files in jar...how??

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I wish to use tag files using jar file. Below are my files..

//TagExample.jsp ...referring the tag file

This is an example of tag.
<%@ taglib prefix="myTag" uri="tagloc" %>
<myTag:Header headerVal="<h1>This part constitues header</h1>" />
<myTag:Body color="Red">
Our company is a startup company and we are hopeful that in two years time,
our company will be listed in NASDAQ. Kindly invest in our company. We are
searching for investors.
</myTag:Body>
<myTag:Footer footerVal="Copyright of our company" />

//This the tld..
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">;
<taglib>
<tlib-version>1.2</tlib-version>
<jspversion>2.0</jspversion>
<uri>tagloc</uri>
<tag-file>
<description> TLD for tag files </description>
<name>Header</name>
<path>/META-INF/tags</path>
</tag-file>
</taglib>

//This is how i created the jars..
jar cvf tags.jar META-INF\tags\Header.tag

I am getting null pointer exception in tomcat...what to mention in name tag in tld..

Thanks in advance..
SAM..
 
Kuppusamy Venkatasubramanian
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Kuppusamy Venkatasubramanian:
Hi,

I wish to use tag files using jar file. Below are my files..

//TagExample.jsp ...referring the tag file

This is an example of tag.
<%@ taglib prefix="myTag" uri="tagloc" %>
<myTag:Header headerVal="<h1>This part constitues header</h1>" />
<myTag:Body color="Red">
Our company is a startup company and we are hopeful that in two years time,
our company will be listed in NASDAQ. Kindly invest in our company. We are
searching for investors.
</myTag:Body>
<myTag:Footer footerVal="Copyright of our company" />

//This the tld..
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">;
<taglib>
<tlib-version>1.2</tlib-version>
<jspversion>2.0</jspversion>
<uri>tagloc</uri>
<tag-file>
<description> TLD for tag files </description>
<name>Header</name>
<path>/META-INF/tags/Header.tag</path>
</tag-file>
</taglib>

//This is how i created the jars..
jar cvf tags.jar META-INF\tags\Header.tag

I am getting null pointer exception in tomcat...what to mention in name tag in tld..

Thanks in advance..
SAM..



-----
Hi has any one tried the above. When i checked the spec it is saying that there should be a name element in tld referring to the tag filename without .tag extention. I mentioned that also but what to mention in <uri> element in the tld. Besided does there need to be an element in web.xml that maps tagdir"/WEB-INF/tags" to a uri in the tld.

SAM..
 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this in web.xml

 
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Where you place the .tld file for this tag file? I think it must be under META-INF directory in the same .jar file. Create .jar file from the sub-directory where you place the META-INF directory. The jar file shuold contain .tag and .tld file.

Thanks
 
Destroy anything that stands in your way. Except this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic