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