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");
}
%>
<%=session.getAttribute("username") %><br />
最后一句中的key改为<%=session.getAttribute("loginuser") %><br />,你在setAttribute时的key值为"loginuser",getAttribute取出来也应该是"loginuser"