JavaWeb创建session

1、 HttpSession session = ServletActionContext.getRequest().getSession(); //创建
2、 ActionContext.getContext().getSession().put("msg", "Hello World from Session!"); //存
session.setAttribute("softtypeid", softtypeid); //存
获取 if(session.getAttribute("softtypeid")!=null){
if(!softtypeid.equals(session.getAttribute("softtypeid")))
pager_offset=1; //如果不是同一种分类,返回是第一页
}
3、 
HttpServletRequest request = ServletActionContext.getRequest();
HttpServletResponse response = ServletActionContext.getResponse(); 

HttpSession session = request.getSession(); //创建


你可能感兴趣的:(Java,web)