1、创建session:
ActionContext actionContext = ActionContext.getContext(); Map<String, Object> mapSession = actionContext.getSession(); mapSession.put("branch", branch); mapSession.put("permission", per);
2、jsp读取session
if(session.getAttribute("branch") == null||session.getAttribute("permission") == null)
{
response.setCharacterEncoding("utf-8");
out.print("<script>alert('您还没有登录,请登录') </script>");
out.flush();
out.close();
}
3、java后台读取session的值
ActionContext actionContext = ActionContext.getContext();
Map session = actionContext.getSession();
String inputUserid =(String)session.get("username");
String proving =(String)session.get("proving");
