*
The moose likes JSP and the fly likes jasperexception in tld file reference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "jasperexception in tld file reference" Watch "jasperexception in tld file reference" New topic
Author

jasperexception in tld file reference

vijay joseph
Greenhorn

Joined: Feb 26, 2007
Posts: 18
hi,
iam new to custom tag and i was trying for my custom tag example,my jsp file showing me the error tld file was not found.please help me to solve this,

my tld file was:

?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.0" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>first</shortname>
<uri/>
<info>A simple tab library for the
examples</info>
<tag>
<name>hello</name>
<tagclass>tags.HelloTag</tagclass>
<bodycontent>empty</bodycontent>
<info>Say Hi</info>
</tag>
</taglib>
<tag>
<name>HelloTag</name>
<tag-class>HelloTag</tag-class>
<body-content>scriptless</body-content>
</tag>
</taglib>

i placed it inside /WEB-INF/tlds directory

and this is my jsp:the error is org.apache.jasper.JasperException: File "/WEB-INF/tlds/mytaglib.tld" not found



1:<%@page contentType="text/html"%>
2:<%@page pageEncoding="UTF-8"%>
3:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
4: "http://www.w3.org/TR/html4/loose.dtd">
5:<%@taglib prefix="first" uri="/WEB-INF/tlds/mytaglib.tld"%>
6:<HTML>
7:<HEAD>
8:<TITLE>Hello Tag</TITLE>
9:</HEAD>
10:<BODY bgcolor="#ffffcc">
11:<B>My first tag prints</B>:
12:<first:hello/>
</BODY>
</HTML>
[ September 04, 2007: Message edited by: vijay joseph ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61105
    
  66

Give your TLD a URI and use that URI when referencing it on the pages.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
vijay joseph
Greenhorn

Joined: Feb 26, 2007
Posts: 18
sorry bear, i couldnt get you can you tell me clearly
vijay joseph
Greenhorn

Joined: Feb 26, 2007
Posts: 18
my old problem was cleared the mistake i didnt mention correct uri, but i have new exception as:
org.apache.jasper.JasperException: Unable to initialize TldLocationsCache: XML parsing error on file /WEB-INF/tags/mytaglib.tld: (line 14, col 1)

mytaglib.tld:


<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.0" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd">
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>HelloTag</short-name>
<tag>
<name>good</name>
<tag-class>tags.HelloTag</tag-class>
<body-content>empty</body-content>
</tag>
</taglib>

please any one help
thanks in advance
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61105
    
  66

What's at "line 14, col 1"?
 
jQuery in Action, 2nd edition
 
subject: jasperexception in tld file reference