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

bruce-feng 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
急急急














...全文
1074 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
bruce-feng 2008-08-05
  • 打赏
  • 举报
回复
没解决!能不能说详细点呢?
tanglinfeng 2008-05-13
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 mfkujjisk 的回复:]
问题解决没,
在jdk 1.5之后enum为关键字,
[/Quote]


非常感谢
mfkujjisk 2008-03-17
  • 打赏
  • 举报
回复
问题解决没,
在jdk 1.5之后enum为关键字,
bruce-feng 2007-10-11
  • 打赏
  • 举报
回复
请个为高手帮小弟解决下,感激不尽

24,923

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Apache
社区管理员
  • Apache
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧