龙历旗
2016-09-06 21:48
doLogin.jsp <jsp:useBean id="myUser" class="lly.login.entity.User" scope="session" /> <jsp:useBean id="myUserDao" class="lly.login.dao.UserDao" scope="session" /> <jsp:setProperty property="*" name="myUser" /> <% out.println("!"); boolean flag = myUserDao.check(myUser); out.println(flag); if (flag) { session.setAttribute("myUser", myUser.getUsername()); request.getRequestDispatcher("login_success.jsp").forward(request, response); } else { response.sendRedirect("login_failure.jsp"); } %>
login_success.jsp <% String myUser = ""; if(session.getAttribute("myUser")!=null){ myUser =(String)session.getAttribute("myUser"); } %> 欢迎您:<font color="red"><%=myUser %></font>登陆成功!
type Exception report message An exception occurred processing JSP page /doLogin.jsp at line 10 description The server encountered an internal error that prevented it from fulfilling this request.
你的名字起冲突了,session中有一个myUser的类了,你的session.setAttribute("myUser", myUser.getUsername());又传进去一个myUser字符
明天问老师去。。
JAVA遇见HTML——JSP篇
248277 学习 · 3071 问题
相似问题
回答 2
回答 3