aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Tag files in jar...how?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Tag files in jar...how??" Watch "Tag files in jar...how??" New topic
Author

Tag files in jar...how??

Kuppusamy Venkatasubramanian
Ranch Hand

Joined: Dec 30, 2004
Posts: 91
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..


SCJP1.4, SCBCD 1.3, SCWCD 1.4, SCEA 5, JLPT-N3
My Blog
Kuppusamy Venkatasubramanian
Ranch Hand

Joined: Dec 30, 2004
Posts: 91
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..
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
Try this in web.xml



Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
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


Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Tag files in jar...how??