问题描述
<%@pagelanguage="java"contentType="text/html;charset=GBK"%><%@pageimport="java.sql.Connection"%><%@pageimport="java.sql.PreparedStatement"%><%@pageimport="entity.Userinfo"%><%@pageimport="dao.BaseDao"%><%@pageimport="java.sql.ResultSet"%><%request.setCharacterEncoding("GBK");Stringname=request.getParameter("loginname");Stringpass=request.getParameter("password");Connectionconn=null;PreparedStatementpstmt=null;ResultSetrs=null;BaseDaobasedao=newBaseDao();try{conn=basedao.getConn();Stringsql="select*fromuserinfowhereloginname='"+name+"'"+"andpassword='"+pass+"'";pstmt=conn.prepareStatement(sql);rs=pstmt.executeQuery();if(rs.next()){Userinfoinfo=newUserinfo(name,pass);session.setAttribute("login",info);response.sendRedirect("index.jsp");}else{response.sendRedirect("demologin.html");}}catch(Exceptione){out.println("发生错误")+e.getMessage();}finally{basedao.closeAll(conn,pstmt,rs);}%>提示是第八行错误2009-10-2113:10:02org.apache.catalina.core.StandardWrapperValveinvoke严重:Servlet.service()forservletjspthrewexceptionorg.apache.jasper.JasperException:UnabletocompileclassforJSP:Anerroroccurredatline:8inthejspfile:/login.jspTheleft-handsideofanassignmentmustbeavariable5:<%@pageimport="dao.BaseDao"%>6:<%@pageimport="java.sql.ResultSet"%>7:8:<%9:request.setCharacterEncoding("GBK");10:Stringname=request.getParameter("loginname");11:Stringpass=request.getParameter("password");Anerroroccurredatline:8inthejspfile:/login.jspSyntaxerrorontoken"+",invalidAssignmentOperator5:<%@pageimport="dao.BaseDao"%>6:<%@pageimport="java.sql.ResultSet"%>7:8:<%9:request.setCharacterEncoding("GBK");10:Stringname=request.getParameter("loginname");11:Stringpass=request.getParameter("password");
解决方案
解决方案二:
哪位达人帮忙看看?
解决方案三:
在线等,急求啊。。。
解决方案四:
你把request.setCharacterEncoding("GBK");去掉看看,乱码用newString()进行转换
解决方案五:
%@page%@空格page
解决方案六:
org.apache.jasper.JasperException:UnabletocompileclassforJSP这个报错说明不能够完成类的编译。你好好检查一下使用的JDK之类的都保持一致了吗?同时好好检查一下你的代码,是不是有些逗号、分号之类的使用了中文格式。
解决方案七:
获取密码和用户名是否正确是否对应表单里的文本框名
解决方案八:
语法错误,都不能编译,这样的问题也贴出来!
解决方案九:
去看看你的jsp生成的java文件。
解决方案十:
服务器没问题,别的页面都可以显示,就是这个处理页面不行。。。。
解决方案十一:
引用4楼xiaozhangnima的回复:
%@page%@空格page
不是这个的问题,修改了还是报500错误你把request.setCharacterEncoding("GBK");去掉看看,乱码用newString()进行转换去掉了,也没用。。。。
解决方案十二:
求解求解啊
解决方案十三:
把整页的代码发出来看看啊,这样谁也整不明白啊……
解决方案十四:
Stringname=request.getParameter("loginname");Stringpass=request.getParameter("password");之后加判定name和pass是否为null,
解决方案十五:
"'"+"andpassword='"改成"'andpassword='"你写的看着别扭,去了空格,什么异常啊贴全点
解决方案:
路过…………根据你的描述,8行报错,应该是你页面调用类时出的问题。自己再好好检查一下,比如对象声明,连接获取等等。个人建议,像这种编译问题,最好是自己解决,不要放弃,并且在解决的过程中也能获得不少知识,希望你能找到答案。路过…………
解决方案:
<%@pagelanguage="java"contentType="text/html;charset=GBK"%><%@pageimport="java.sql.Connection"%><%@pageimport="java.sql.PreparedStatement"%><%@pageimport="entity.Userinfo"%><%@pageimport="dao.BaseDao"%><%@pageimport="java.sql.ResultSet"%><%request.setCharacterEncoding("GBK");Stringname=request.getParameter("loginname");Stringpass=request.getParameter("password");Connectionconn=null;PreparedStatementpstmt=null;ResultSetrs=null;BaseDaobasedao=newBaseDao();try{conn=basedao.getConn();Stringsql="select*fromuserinfowhereloginname='"+name+"'andpassword='"+pass+"'";pstmt=conn.prepareStatement(sql);rs=pstmt.executeQuery();if(rs.next()){Userinfoinfo=newUserinfo(name,pass);session.setAttribute("login",info);response.sendRedirect("index.jsp");}else{response.sendRedirect("demologin.html");}}catch(Exceptione){out.println("发生错误")+e.getMessage();}finally{basedao.closeAll(conn,pstmt,rs);}%>