JDK1.5 + TOMCAT5  为什么会出现下列问题呢??? 

04-11-19 cute
为什么我的很简单的JSP页面会出现下面问题??

JDK1.5 + TOMCAT5  为什么会出现下列问题呢??? 


============== 

type Exception report 

message 

description The server encountered an internal error () that prevented it from fulfilling this request. 

exception 

org.apache.jasper.JasperException: /index.jsp(2,4) Invalid directive 
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39) 
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409) 
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:90) 
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:506) 
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:470) 
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451) 
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439) 
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:810) 
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75) 


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

========================================================

我的JSP页面只有: 

<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %> 

======== 
运行时出现下列问题: 

type Exception report 

message 

description The server encountered an internal error () that prevented it from fulfilling this request. 

exception 

org.apache.jasper.JasperException: Unable to compile class for JSP 

Generated servlet error: 
F:\jboss-4.0.0\server\default\work\jboss.web\localhost\test\org\apache\jsp\a_jsp.java:3: package javax.servlet does not exist 
import javax.servlet.*; 
^ 


Generated servlet error: 
F:\jboss-4.0.0\server\default\work\jboss.web\localhost\test\org\apache\jsp\a_jsp.java:4: package javax.servlet.http does not exist 
import javax.servlet.http.*; 
^ 


Generated servlet error: 
F:\jboss-4.0.0\server\default\work\jboss.web\localhost\test\org\apache\jsp\a_jsp.java:5: package javax.servlet.jsp does not exist 
import javax.servlet.jsp.*; 
^ 


Generated servlet error: 
F:\jboss-4.0.0\server\default\work\jboss.web\localhost\test\org\apache\jsp\a_jsp.java:8: package org.apache.jasper.runtime does not exist 
public final class a_jsp extends org.apache.jasper.runtime.HttpJspBase 
^ 


Generated servlet error: 
F:\jboss-4.0.0\server\default\work\jboss.web\localhost\test\org\apache\jsp\a_jsp.java:9: package org.apache.jasper.runtime does not exist 
implements org.apache.jasper.runtime.JspSourceDependent { 
^ 


Generated servlet error: 
F:\jboss-4.0.0\server\default\work\jboss.web\localhost\test\org\apache\jsp\a_jsp.java:17: cannot find symbol 
symbol : class HttpServletRequest 
location: class org.apache.jsp.a_jsp 
public void _jspService(HttpServletRequest request, HttpServletResponse response) 
^ 


Generated servlet error: 
F:\jboss-4.0.0\server\default\work\jboss.web\localhost\test\org\apache\jsp\a_jsp.java:17: cannot find symbol 
symbol : class HttpServletResponse 
location: class org.apache.jsp.a_jsp 
public void _jspService(HttpServletRequest request, HttpServletResponse response) 
^ 


Generated servlet error: 
F:\jboss-4.0.0\server\default\work\jboss.web\localhost\test\org\apache\jsp\a_jsp.java:18: cannot find symbol 
symbol : class ServletException 
location: class org.apache.jsp.a_jsp 
throws java.io.IOException, ServletException { 
^ 


Generated servlet error: 
F:\jboss-4.0.0\server\default\work\jboss.web\localhost\test\org\apache\jsp\a_jsp.java:20: cannot find symbol 
symbol : class JspFactory 
location: class org.apache.jsp.a_jsp 
JspFactory _jspxFactory = null; 
^ 


Generated servlet error: 
F:\jboss-4.0.0\server\default\work\jboss.web\localhost\test\org\apache\jsp\a_jsp.java:21: cannot find symbol 
symbol : class PageContext 
location: class org.apache.jsp.a_jsp 
PageContext pageContext = null; 
^ 


Generated servlet error: 
F:\jboss-4.0.0\server\default\work\jboss.web\localhost\test\org\apache\jsp\a_jsp.java:22: cannot find symbol 
symbol : class HttpSession 
location: class org.apache.jsp.a_jsp 
HttpSession session = null; 
^ 


Generated servlet error: 
F:\jboss-4.0.0\server\default\work\jboss.web\localhost\test\org\apache\jsp\a_jsp.java:23: cannot find symbol 
symbol : class ServletContext 
location: class org.apache.jsp.a_jsp 
ServletContext application = null; 
<p>

banq
2004-11-20 22:47
/index.jsp(2,4)显示,在index.jsp的第二行第4个字符开始出错。

不要在Jsp中写入Java代码,如果是标签库,检查标签库语法。

cute
2004-11-21 10:44
现在问题是这样班竹==》index.jsp 这个页面是空的。。。

我目前用JDK5+JBOSS 作了一个虚拟目录(f:\test)。。

我就在这个目录中建了 index.jsp 可是就是无法编译!!! 

我真奇怪。。。 还有在TOMCAT5 中 也同样出现了问题。。。

就是无法编译JSP 或是 说  找不到 SERVLET 。。。 

我真晕了。。。 应用服务器都带了类库。。。 我还用加什么呢!!

banq
2004-11-21 12:38
是容器版本的原因,缺少支持Servlet/Jsp的包。

cute
2004-11-22 07:57
经过多次试用TOMCAT5 问题还是不能解决(在虚拟目录中运行JSP)...

而在,它自己的例子目录中却什么都好用!!

真个问题,我真的是无法解决了..

另外,我发现如果要把原先的JSP1.2 的页面拿到 TOMCAT5 下运行,要改一些地方... 比如 import 前要加 page ...

高版本难道不向下兼容嘛?

猜你喜欢
2Go 1 2 下一页