在项目里面用的struts2,在action里面能正确取到session
但如果不是在action里面,没有用action,我直接弹出一个页面,在页面里面就取不到session,这是怎么回事呀.
取session我是这样取的
Map mapSession = ServletActionContext.getContext().getSession();在action里面能取到,如果页面是通过action跳转过去的也能正确取到,但如果页面是直接window.open()出来的就取不到,为什么呀????
但如果不是在action里面,没有用action,我直接弹出一个页面,在页面里面就取不到session,这是怎么回事呀.
取session我是这样取的
Map mapSession = ServletActionContext.getContext().getSession();在action里面能取到,如果页面是通过action跳转过去的也能正确取到,但如果页面是直接window.open()出来的就取不到,为什么呀????
Map mapSession = ServletActionContext.getContext().getSession();
取得mapSession为null ,如果页面是通过action跳转过去的就能取到.郁闷死了.
直接用el试下
但用struts2提供的ServletActionContext.getContext().getSession(); 怎么就了不到呢,郁闷哟.
ActionContext.getContext().getSession();
到了jsp页面上,可以直接用session它是隐含对象,页面已经 不是struts2的范围了