读书人

Action 中获取 session的步骤ActionCo

发布时间: 2012-08-22 09:50:35 作者: rapoo

Action 中获取 session的方法ActionContext.getContext().getSession() 是一个Map对象。

1:?

Java代码?
ActionContext.getContext().getSession()???

ActionContext.getContext().getSession()?


这个方法获得的不是HttpSession对象,而是一个Map对象。?


要存值进去或者取值需要用以下方法?



2:用法?

Java代码?
ActionContext.getContext().getSession().put("validateCode", s);???????
?????
ActionContext.getContext().getSession().get("validateCode")????

ActionContext.getContext().getSession().put("validateCode", s);????
??
ActionContext.getContext().getSession().get("validateCode")??


以上方法和session.setAttribute();session.getAttribute();的作用相同,并且可以混用?

读书人网 >Web前端

热点推荐