回 帖 发 新 帖 刷新版面

主题:标签菜鸟问题!!

Unable to initialize TldLocationsCache: XML parsing error 怎么回事啊?怎么解决??
我按着<<jsp web开发指南>>p203 的步骤,学用标签.结果却显示不出. 我的站台目录是D:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\tagLib,
在该目录下有显示当前时间的jsp文件current.jsp, 如下:
<%@ taglib prefix="example" uri="WEB-INF/exampleTags.tld" %>
<html>
<head></head>
<body>
   welcome to my web page. The current time is <example:time />
</body>
</html>

在{webapps}/tablib/目录下有exampleTags.tld文件,内容是:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE taglib PUBLIC
                  "-//Sun Microsystems,Inc.//DTD JSP Tag Library 1.2//EN"
                   "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
   <tlib-version>1.0</tlib-version>
   <jsp-version>1.2</jsp-version>
   <short-name>ExampleTags</short-name>
   <description>A set of example tag handlers.</description>
   <tag>
        <name>time</name>
        <tag-class>timeTag</tag-class>
   </tag>
</taglib>

而我的标签处理程序timeTag.class也是编译通过了的.放在{webapps}/tablib/classes目录下.

请问:我哪里出错了? 有什么解决方法?在浏览器中输入http://202.112.14.124:8080/tagLib/currentTime.jsp 运行时,出现如下错误提示:
org.apache.jasper.JasperException: Unable to initialize TldLocationsCache: XML parsing error on file /WEB-INF/exampleTags.tld
    org.apache.jasper.compiler.TldLocationsCache.init(TldLocationsCache.java:249)
    org.apache.jasper.compiler.TldLocationsCache.getLocation(TldLocationsCache.java:220)
    org.apache.jasper.JspCompilationContext.getTldLocation(JspCompilationContext.java:475)
    org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:417)
    org.apache.jasper.compiler.Parser.parseDirective(Parser.java:483)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1539)
    org.apache.jasper.compiler.Parser.parse(Parser.java:126)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:220)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:490)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:471)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:459)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.29 logs.

回复列表 (共1个回复)

沙发

你最好把你那个程序放在Tomcat 5.0\webapps\root文件下试试

我来回复

您尚未登录,请登录后再回复。点此登录或注册