struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Srinivas Surapaneni" <srinivas.surapan...@gmail.com>
Subject Re: [struts] struts result going to a current page
Date Sat, 16 Feb 2008 23:49:30 GMT
To be more specific, Here is we can do in Beehive Pageflow which is based on
struts 1.x

I am trying to do a similar thing in Struts 2

@Jpf.ExceptionHandler(forwards = { @Jpf.Forward(name = "recoverableError",
navigateTo = Jpf.NavigateTo.page) })
 protected Forward handleRecoverableException(
   RecoverbaleException ex, String actionName,
   String message, Object form) throws Exception{
     // code
      this.addActionError(Globals.ERROR_KEY, key, null);
        return new Forward( "recoverbleError" );
 }
The above is the global exception handler. If any RecoverbaleException
happens anywhere in the application the request is send back to the current
page by means of Jpf.NavigareTo.Page

Thanks
On Feb 16, 2008 6:41 PM, Srinivas Surapaneni <srinivas.surapaneni@gmail.com>
wrote:

> Yes,
>
> I want to return to whatever page referred the current request. Whenever a
> recoverable exception happens, I want to return to the current page so that
> user can take some action
>
> I am trying to avoid defining exception handling at each action level and
> do globally  and want to access the current page
>
> Thanks
>
>   On Feb 16, 2008 3:02 PM, Dale Newfield <Dale@newfield.org> wrote:
>
> > Srinivas Surapaneni wrote:
> > > I want the current page in the global exception handler. Instead of
> > giving a
> > > specific jsp page, I want to return to what ever the current page is
> >
> > That desire is not well specified.  Do you mean you want to return to
> > whatever page referred the current request?  Do you really want to
> > re-load that page (which may or may not be from within your webapp), or
> > is simply not changing the content currently being displayed sufficient?
> >
> > The http return code 204 (or "no content") will leave the browser where
> > it was.
> >
> > Otherwise it sounds like you want to redirect to the "referer" (yes,
> > it's misspelled in the specification).  Note if that page was the result
> > of a POST you pretty much can't redirect to it.
> >
> > -Dale
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>

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