JSP制作动态网页,Tomcat预览时错误提示:
org.apache.jasper.JasperException:UnabletocompileclassforJSP:Anerroroccurredatline:8i...
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 8 in the jsp file: /checklogin.jsp
name cannot be resolved
5: <%
6: String username = request.getParameter("name");
7: String password = request.getParameter("password");
8: String sql ="select * from member where name='"+name+"' and password='"+password+"'";
9: Statement stmt=conn.createStatement();
10: ResultSet rs = stmt.executeQuery(sql);
11: if ("用户名正确".equals(s)){
An error occurred at line: 11 in the jsp file: /checklogin.jsp
s cannot be resolved
8: String sql ="select * from member where name='"+name+"' and password='"+password+"'";
9: Statement stmt=conn.createStatement();
10: ResultSet rs = stmt.executeQuery(sql);
11: if ("用户名正确".equals(s)){
12: session.setAttribute("name",name);
13: response.sendRedirect("re-index.html");
14: }else if (false){%>
An error occurred at line: 12 in the jsp file: /checklogin.jsp
name cannot be resolved
9: Statement stmt=conn.createStatement();
10: ResultSet rs = stmt.executeQuery(sql);
11: if ("用户名正确".equals(s)){
12: session.setAttribute("name",name);
13: response.sendRedirect("re-index.html");
14: }else if (false){%>
15: <%}else{%>
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:317)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
希望能把这一段代码纠正...随时调试正确代码- - 展开
An error occurred at line: 8 in the jsp file: /checklogin.jsp
name cannot be resolved
5: <%
6: String username = request.getParameter("name");
7: String password = request.getParameter("password");
8: String sql ="select * from member where name='"+name+"' and password='"+password+"'";
9: Statement stmt=conn.createStatement();
10: ResultSet rs = stmt.executeQuery(sql);
11: if ("用户名正确".equals(s)){
An error occurred at line: 11 in the jsp file: /checklogin.jsp
s cannot be resolved
8: String sql ="select * from member where name='"+name+"' and password='"+password+"'";
9: Statement stmt=conn.createStatement();
10: ResultSet rs = stmt.executeQuery(sql);
11: if ("用户名正确".equals(s)){
12: session.setAttribute("name",name);
13: response.sendRedirect("re-index.html");
14: }else if (false){%>
An error occurred at line: 12 in the jsp file: /checklogin.jsp
name cannot be resolved
9: Statement stmt=conn.createStatement();
10: ResultSet rs = stmt.executeQuery(sql);
11: if ("用户名正确".equals(s)){
12: session.setAttribute("name",name);
13: response.sendRedirect("re-index.html");
14: }else if (false){%>
15: <%}else{%>
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:317)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
希望能把这一段代码纠正...随时调试正确代码- - 展开
展开全部
改成
String name= request.getParameter("name");
String password = request.getParameter("password");
String sql ="select * from member where name='"+name+"' and password='"+password+"'";
Statement stmt=conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
if(rs!=null&&rs.next()){
session.setAttribute("name",name);
response.sendRedirect("re-index.html");
}else{
out.println("用户名或密码错误");
}
别的代码看不到了
String name= request.getParameter("name");
String password = request.getParameter("password");
String sql ="select * from member where name='"+name+"' and password='"+password+"'";
Statement stmt=conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
if(rs!=null&&rs.next()){
session.setAttribute("name",name);
response.sendRedirect("re-index.html");
}else{
out.println("用户名或密码错误");
}
别的代码看不到了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询