The map returned is wrapping the HttpSession, try using it.
If you really want the HttpSession object you have to get it from the HttpServletRequest object, ServletActionContext.getRequest().
Jonas
remigijus wrote:
I tryed this way but I keep getting exceptions. Maybe I have missed somthing in mu config settings.
Here is the code
public String execute() throws Exception { ActionContext ctx = ActionContext.getContext(); HttpSession session = (HttpSession) ctx.getSession(); // <<<<<< Here I'm getting exception. SessionModel sessionModel; try { sessionModel = (SessionModel) session.getAttribute("lt.uosis.SessionModel"); } catch (Exception e) { sessionModel = new SessionModel(); sessionModel.setSelectedCategoryId(id); session.setAttribute("lt.uosis.SessionModel", sessionModel); }
return SUCCESS; }
and here is the exception:
SEVERE: Could not execute action java.lang.ClassCastException at lt.uosis.admin.action.OpenCategoryAction.execute(OpenCategoryAction.java:28) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocatio n.java:172) at com.opensymphony.xwork.interceptor.DefaultWorkflowInterceptor.intercept(Defa ultWorkflowInterceptor.java:58) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocatio n.java:169) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterce ptor.java:37) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocatio n.java:169)
----- Original Message ----- From: "Jonas Eriksson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, December 04, 2003 2:53 PM Subject: Re: [OS-webwork] How to access session data from ActionClass
The session and application maps are accessed by using static methods of the ActionContext class.
To get the session map you write Map session = ActionContext.getContext().getSession();
Jonas
remigijus wrote:
Hi
How can get access to a session and application scope data from an Action class. If possible a little code sample, please.
Remis
------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork