我用jsp+tomcat调试jsp程序,出现Enumeration cannot be resolved 但我的程序有<%@ page language="java" import="java.sql.*" import="java.util.*"%>

bruce-fang 嵌入式软件工程师  2007-10-11 02:40:13

我的jsp文件是:
<%@ page language="java" import="java.sql.*" import="java.util.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Including the output of other jsps</title>
</head>

<body>
<% Enumeration enum = request.getParameterNames();
while(enum.hasMoreElements()){
String inputName = (String)enum.nextElement();
String inputVale = request.getParameter(inputName);
if(inputValue.equals("golferStats")){
%>
<jsp:include page="ShowGolferStats.jsp"/>
<%
}else if(inputValue.equals("courseStats")){
%>
<jsp:include page="ShowCourseStats.jsp"/>
<%}//end else clause
}//end while loop
%>
</body>
</html>


具体的错误是:


HTTP Status 500 -

--------------------------------------------------------------------------------

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:

An error occurred at line: 9 in the jsp file: /Hour16/DataPresentation.jsp
Enumeration cannot be resolved
6: </head>
7:
8: <body>
9: <% Enumeration enum = request.getParameterNames();
10: while(enum.hasMoreElements()){
11: String inputName = (String)enum.nextElement();
12: String inputVale = request.getParameter(inputName);


An error occurred at line: 9 in the jsp file: /Hour16/DataPresentation.jsp
Syntax error on token "enum", delete this token
6: </head>
7:
8: <body>
9: <% Enumeration enum = request.getParameterNames();
10: while(enum.hasMoreElements()){
11: String inputName = (String)enum.nextElement();
12: String inputVale = request.getParameter(inputName);


An error occurred at line: 10 in the jsp file: /Hour16/DataPresentation.jsp
Syntax error on token "enum", invalid Expression
7:
8: <body>
9: <% Enumeration enum = request.getParameterNames();
10: while(enum.hasMoreElements()){
11: String inputName = (String)enum.nextElement();
12: String inputVale = request.getParameter(inputName);
13: if(inputValue.equals("golferStats")){


An error occurred at line: 11 in the jsp file: /Hour16/DataPresentation.jsp
Syntax error on token "enum", delete this token
8: <body>
9: <% Enumeration enum = request.getParameterNames();
10: while(enum.hasMoreElements()){
11: String inputName = (String)enum.nextElement();
12: String inputVale = request.getParameter(inputName);
13: if(inputValue.equals("golferStats")){
14: %>


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


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


--------------------------------------------------------------------------------

Apache Tomcat/6.0.14
急急急














...全文
1012 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
bruce-fang 2008-08-05
没解决!能不能说详细点呢?
回复
tanglinfeng 2008-05-13
[Quote=引用 2 楼 mfkujjisk 的回复:]
问题解决没,
在jdk 1.5之后enum为关键字,
[/Quote]


非常感谢
回复
mfkujjisk 2008-03-17
问题解决没,
在jdk 1.5之后enum为关键字,
回复
bruce-fang 2007-10-11
请个为高手帮小弟解决下,感激不尽
回复
相关推荐
发帖
Apache
创建于2007-09-28

2.4w+

社区成员

Web 开发 Apache
申请成为版主
帖子事件
创建了帖子
2007-10-11 02:40
社区公告
暂无公告