You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by frankiestd168 <ch...@hotmail.com> on 2006/10/30 15:56:23 UTC
Struts2 set data to session
Before in Struts1, I can set data to session/request in action class, then
display it in jsp..
In action class:
request.setAttribute("aName", "aValue");
request.getSession().setAttribute("bName, ""bValue");
then display value in jsp:
<%= (String)request.getAttribute("aName") %>
<%= (String)session.getAttribute("bName") %>
But in Struts2, how can I do that?
e.g. I used Mailreader sample code, I tried in action class, execute()
function, do this...
Map mySession = this.getSession();
mm.put("cName", "cValue");
this.setSession(mm);
but in jsp, <%= session.getAttribute("cName") %> is null.
Any idea?
--
View this message in context: http://www.nabble.com/Struts2-set-data-to-session-tf2539904.html#a7076046
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org