同學(xué)們,誰能告訴我,我下面的代碼怎么錯了,執(zhí)行不對
<body>
?? ?<h1>request內(nèi)置對象</h1>
?? ?<%
?? ??? ?request.setCharacterEncoding("utf-8");//解決中文亂碼問題,無法解決URL傳遞中文亂碼問題。
?? ?%>
?? ?用戶名:<%=request.getParameter("username")%>
?? ?密碼:<%=request.getParameter("password") %>
?? ?愛好:<%
?? ??? ?String[] favorites = request.getParameterValues("favorite");
?? ??? ?for(int i = 0;i < favorites.length;i++){
?? ??? ??? ?out.println(favorites[i]+" ");
?? ??? ?}
?? ?%>
</body>
2019-10-21
?for(int i = 0;i < favorites.length;i++)? ? ? i<后面多了個空格
2019-03-17
三月 17, 2019 10:02:59 上午 org.apache.catalina.core.StandardWrapperValve invoke
嚴(yán)重: Servlet.service() for servlet [jsp] in context with path [/MyJspProject] threw exception [java.lang.ClassNotFoundException: org.apache.jsp.request_jsp] with root cause
java.lang.ClassNotFoundException: org.apache.jsp.request_jsp
Stacktrace:] with root cause
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: [17] in the jsp file: [/request.jsp]
Syntax error on token "Invalid Character", delete this token
14: ?? ?瀵嗙爜:<%=request.getParameter("password") %>
15: ?? ?鐖卞ソ:<%
16: ?? ??? ?String[] favorites = request.getParameterValues("favorite");
17: ?? ??? ?for(int i = 0;i <銆?favorites.length;i++){
18: ?? ??? ??? ?out.println(favorites[i]+" ");
19: ?? ??? ?}
20: ?? ?%>
我只要把這段代碼替換成老師,就沒有任何問題。