关于jsp中自定义标志的初级问题,请大家指点一下.....急呀!!!(50分)

  • 主题发起人 主题发起人 h_o_u_l_i
  • 开始时间 开始时间
H

h_o_u_l_i

Unregistered / Unconfirmed
GUEST, unregistred user!
1.我把.tlb(内容如下)文件放在/WEB-INF目录中,但启动tomcat时总是出如下错误:
XmlMapper:Can't find resource for entity:-//sun Microsystems,Inc.//DTD JSP Tag Library 1.1//EN
--> http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd "null"
2.若把.tlb放在其他目录,并在jsp中用 <%@ taglib uri="/JavaScriptExampleTag.tld" prefix="tagexample"%>
引用时,ie中出现如下错误:
type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: XML parsing error on file /JavaScriptExampleTag.tld: java.net.UnknownHostException: java.sun.com
at org.apache.jasper.parser.ParserUtils.parseXMLDocument(ParserUtils.java:231)
at org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:283)
at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:219)
at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:174)
at org.apache.jasper.compiler.JspParseEventListener.processTaglibDirective(JspParseEventListener.java:1170)
at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEventListener.java:765)
at org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingListener.java:125)
at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:255)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1145)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1103)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1099)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:214)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:210)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:548)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:176)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:188)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:536)
我所建立的标志处理器(JavaScriptExampleTag.java)都编译并通过!
请问我该怎么解决?真的很着急,我初学希望各位帮帮忙!

.tlb 内容:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>JavaScriptExampleTag</shortname>
<uri></uri>
<info>A simple tag library for making a JavaScript alert</info>
<tag>
<name>message</name>
<tagclass>com.JavaScriptExampleTag</tagclass>
<info>Display Alert Box</info>
</tag>
</taglib>
 
JSP Tag Library 1.1???
///java.net.UnknownHostException: java.sun.com
这个错误的意思是xml验证dtd的时候,因为你的dtd的路径是:
http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd
而你的机器可能没有联网或者其它原因导致无法访问到这个文件,
因此无法对xml文件进行验证.

 
to lnboy:
那我该如何解决?是联上网就行吗?那每次调试都要上网吗?
能解释详细些吗?先谢谢你了!!
 
后退
顶部