ActionContext.getContext().getSession()

ActionContext.getContext().getSession() 获取的是session,然后用put存入相应的值,只要在session有效状态下,这个值一直可用
ActionContext.getContext().getSession() .put("键","要存放的值");   // 例如在user的setter和getter方法,要放的值相当于getUser()

相当于jsp里

<%=session=getAttribut("键")%>

************************************************************************************

原文地址:https://www.cnblogs.com/tk55/p/6030138.html