tomcat5.5和6.0对自定义标签的支持

      没辙了。在建了个web工程就加了javax.servlet.jsp.jar这个包,按照自定义标签步骤都做好,在tomcat5.5下跑了起来,没问题,问题是换到tomcat6.0.33的版本居然报错了。死活查不了是什么原因。错误如下。

     2011-12-13 10:16:31 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 31 in the generated java file
The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory

Stacktrace:
 at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
 at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
 at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
 at org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
 at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
 at org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
 at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
 at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)
 at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)
 at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)
 at java.lang.Thread.run(Thread.java:662)

 

本来是在struts2的环境下想加入自己的自定义标签,无奈报错,后来才有这后面的工程。

测试不同版本的tomcat居然还会不一样,晕死了。(5.5下成功,6.0报错),例子最简单的,想测通就ok,好继续后面的事。当然网上查了很多例子了,调通,很多说是包的问题,就是查不出了。第一次提问不太会什么规矩,还望多包涵

1个回答

原因很简单,你删掉你lib下的 javax.servlet.jsp.jar即可,因为tomcat6/lib里面有这个jar包,两个有冲突了 !

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!