import com.opensymphony.xwork2.ActionSupport; import org.apache.struts2.interceptor.SessionAware; public class MyAction extends extends ActionSupport implements SessionAware { // For SessionAware Map<String, Object> session; @Override public void setSession(Map<String, Object> session) { this.session = session; } }
public String execute() { int division = ... // Write to the session session.put("division",(Integer)division); // Read from the session if (session.containsKey("division")) division=(Integer)session.get("division"); return "success"; }
<web-app> <!-- How long the sessions will stick around for --> <session-config> <session-timeout>600</session-timeout> <!-- 600seconds = 10 mins --> </session-config> </web-app>
Thanks for reading! And if you want to get in touch, I'd love to hear from you: chris.hulbert at gmail.
(Comp Sci, Hons - UTS)
Software Developer (Freelancer / Contractor) in Australia.
I have worked at places such as Google, Cochlear, Assembly Payments, News Corp, Fox Sports, NineMSN, FetchTV, Coles, Woolworths, Trust Bank, and Westpac, among others. If you're looking for help developing an iOS app, drop me a line!
Get in touch:
[email protected]
github.com/chrishulbert
linkedin