struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mead Lai" <laiqi...@gmail.com>
Subject Re: [S2] Preserving messages across a Redirect in Struts 2
Date Wed, 05 Nov 2008 06:31:24 GMT
"java.lang.UnsupportedOperationException: Don't use default servlet
session".
Just use the session from ActionContext, don't use the servlet's.

protected Map<String,String> getSession() {
        return ActionContext.getContext().getSession();//from ActionContext
here!
}

protected HttpServletRequest request(){
        return ServletActionContext.getRequest();
    }


On Wed, Nov 5, 2008 at 12:05 PM, Narayana S <narayanasgs1@gmail.com> wrote:

> Hi,
>
>       i am using apache Tomcat 6.0.3, struts 2.1.2, and jdk 1.6. can any
> one help me solving this issue?
>
> Thanks in advance.
>
> On Tue, Nov 4, 2008 at 7:06 PM, Greg Lindholm <glindholm@yahoo.com> wrote:
>
> >
> >
> >
> > Ganesh123 wrote:
> > >
> > >          Excellent work. i am looking for the same solution. i tried
> > > implementing your interceptor , but  it is throwing exception ...
> > >   "java.lang.UnsupportedOperationException: Don't use default servlet
> > > session".
> > >
> > > near session.setAttribute(ACTION_MESSAGES_KEY,actionMessages);
> > >
> > >
> >
> > Very strange, I've never seen a session where setAttribute() throws an
> > UnsupportedOperationException.  (And whats a "default servlet session"?)
> > I can only guess it's something to do with your container environment.
> >
> > You had better post your configuration information; platform, container,
> > cluster setup? etc. maybe someone on the list can help.
> >
> > Here are the relevant lines of code from the interceptor.
> >
> > ActionContext actionContext = invocation.getInvocationContext();
> > HttpServletRequest request = (HttpServletRequest)
> >  actionContext.get(StrutsStatics.HTTP_REQUEST);
> > HttpSession session = request.getSession(false);
> > if (session != null)
> > {
> >  ...
> >   Collection actionMessages = validationAware.getActionMessages();
> >  if (actionMessages != null && actionMessages.size() > 0)
> >  {
> >     session.setAttribute(ACTION_MESSAGES_KEY, actionMessages);
> >  }
> >   ...
> > }
> >
> >
> >
> > --
> > View this message in context:
> >
> http://www.nabble.com/-S2--Preserving-messages-across-a-Redirect-in-Struts-2-tp18245061p20322352.html
> > 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
> >
> >
>



-- 
BestRegards,
Mead
http://yayisoft.com

Bill Vaughan  - "The tax collector must love poor people, he's creating so
many of them."

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message