This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Hello Everybody: I wrote a small custom tag. It is not working,I do not know where is the problem? Could some one please give me right directions. Thanks in adavance. My TagHandler Class �TagExample.java� is inside /WEB_INF/classes/bkservletpkg/tags/TagExample.java. It compiled and I saw class file there. My Tag Library Discriptor is at /webapps/ok/jsp/ch14/ bk-taglib.tld as below; <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE tablib PUBLIC "-//Sun Microsystem, Inc.//DTD JSP Tag Library 1.1//EN" "web-jsptaglib_1_1.dtd"> <taglib> <tlibversion>1.0</tlibversion> <jspversion>1.1</jspversion> <shortname>bk</shortname> <uri>/ok/jsp/ch14/tags/bk-taglib.tld</uri> <info>First Custom tab</info> <tag> <name>kali</name> <tagclass>bkservletpkg.tags.TagExample</tagclass> <info>First Example</info> <bodycontent>EMPTY</bodycontent> </tag> </taglib> My JSP test driver is also at same location /webapps/ok/jsp/ch14/firstCustomTag.jsp as below; <%@ taglib uri="bk-taglib.tld" prefix="bk" %> <HTML> <BODY> <BR><BR><H1><CENTER><bk:kali></CENTER></H1> <BR><BR><bk:kali/> </BODY> </HTML> I got following errors. Error: 500 Location: /ok/jsp/ch14/firstCustomTag.jsp Internal Servlet Error: org.apache.jasper.compiler.CompileException: C:\tomcat3\webapps\ok\jsp\ch14\firstCustomTag.jsp(0,0) Unable to open taglibrary bk-taglib.tld : Parse Error in the tag library descriptor: Relative URI "web-jsptaglib_1_1.dtd"; can not be resolved without a document URI. at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEventListener.java:713) at org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingListener.java:116) at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:215) at org.apache.jasper.compiler.Parser.parse(Parser.java:1077) . . . at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501) at java.lang.Thread.run(Thread.java:484) Error says unable to open �taglibrary bk-taglib.tld: Parse Error in the tag� can not be resolved without a document URI. I do not understand this message. Please help me figure it out what am I doing wrong? Thanks again. BK
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12269
1
posted
0
Here is what I used: <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd"> Note that the dtd URI is absolute, not relative. Bill ------------------ author of:
Originally posted by William Brogden: Here is what I used: <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd"> Note that the dtd URI is absolute, not relative. Bill
This should solve your problem, but please note that the problem may recur if the server your Tomcat instance is running on cannot reach the URL http://java.sun.com//... due to firewall setup, etc. An alternative is to instead use something like: <!DOCTYPE taglib SYSTEM "file://my/path/to/local/copy/of/web-jsptaglibrary_1_1.dtd"> (I hope you get the idea that this is an absolute file path).