Enumeration cannot be resolved to a type
程序员文章站
2022-04-25 21:25:22
...
An error occurred at line: 12 in the jsp file: /index.jsp
Enumeration cannot be resolved to a type
9: <body>
10: <%
11: out.println("Hello Word!");
12: Enumeration headerNames = request.getHeaderNames();
13: while (headerNames.hasMoreElements()) {
14: String paramName = (String) headerNames.nextElement();
15: out.print("<tr><td>" + paramName + "</td>\n");
Stacktrace:] with root cause
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 12 in the jsp file: /index.jsp
Enumeration cannot be resolved to a type
9: <body>
10: <%
11: out.println("Hello Word!");
12: Enumeration headerNames = request.getHeaderNames();
13: while (headerNames.hasMoreElements()) {
14: String paramName = (String) headerNames.nextElement();
15: out.print("<tr><td>" + paramName + "</td>\n");
Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:468)
at org.apache.jasper.compiler.Compiler.__compile(Compiler.java:378)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
at org.apache.jasper.servlet.JspServlet._serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:123)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:171)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
解决方案:jsp页面需要引入:
<%@ page import="java.util.*"%>
推荐阅读
-
PHP错误Cannot use object of type stdClass as array in错误的解决办法
-
PHP JSON出错:Cannot use object of type stdClass as array解决方法
-
遇见“The absolute uri: [http://java.sun.com/jsp/jstl/core] cannot be resolved..”怎么办
-
JSP报错javax.servlet.jsp.JspException cannot be resolved to a type solution
-
IOS开发遇到Interface type cannot be statically allocated 问题的解决办法
-
TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type s
-
TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type s
-
configure: error: cannot guess build type; you must specify one
-
The instance of entity type ‘xxx‘ cannot be tracked because another instance with the same key value
-
SpringBoot项目在启动时出现了Cannot determine embedded database driver class for database type NONE 错误