HTTP Status 500 - Unable to compile class for JSP:
在正常注册界面点击提交之后就会出现这样的错误是什么问题?
HTTP Status 500 - Unable to compile class for JSP:
type Exception report
message Unable to compile class for JSP:
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: 28 in the jsp file: /out.jsp
Type mismatch: cannot convert from String[] to String
25: <h1>request鍐呯疆瀵硅薄</h1>
26: 鐢ㄦ埛鍚嶏細<%=request.getParameter("username") %><br>
27: 鐖卞ソ锛�<%
28: String favorites=request.getParameterValues("favorite");
29: for( int i=0;i<favorites.length();i++){
30: out.println(favorites[i]+" ");
31: }
An error occurred at line: 30 in the jsp file: /out.jsp
The type of the expression must be an array type but it resolved to String
27: 鐖卞ソ锛�<%
28: String favorites=request.getParameterValues("favorite");
29: for( int i=0;i<favorites.length();i++){
30: out.println(favorites[i]+" ");
31: }
32: %>
33: </body>
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:490)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:379)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:341)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:663)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:364)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.79 logs.
PS:视频里的request.jsp我写的是out.jsp,还有就是视频下有一个scope.jsp 这个是必须要有的吗,求解答。