为什么获取不到用户名啊
<%
String loginUser="";
if(session.getAttribute("loginUser")!=null){
loginUser=session.getAttribute("loginUser").toString();
}
%>
欢迎您<font color="red"><%=loginUser %></font>,登录成功
<%
String loginUser="";
if(session.getAttribute("loginUser")!=null){
loginUser=session.getAttribute("loginUser").toString();
}
%>
欢迎您<font color="red"><%=loginUser %></font>,登录成功
2016-09-28
这是dogloin里的代码
String username ="";
String password ="";
request.setCharacterEncoding("utf-8");
username=request.getParameter("username");
password=request.getParameter("password");
if("admin".equals(username)&&"admin".equals(password)){
session.setAttribute("loginUser", username);
request.getRequestDispatcher("login_success.jsp").forward(request, response);
}
else{
response.sendRedirect("login_failure.jsp");
}
举报