You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Fabien Modoux <fa...@voicemate.com> on 2001/04/18 04:23:53 UTC

Confirmation page

Hello,

I am new to Struts and I am struggling on what would
be the best way to do the following:

on several pages, the user can perform actions which
need to be confirmed before being actually performed
(e.g., exiting the application or logging off). The
confirmation page is the same regardless of the calling
point, but if the user cancels, I need to go back to
the previous page. I am not sure how to pass the return
url to the confirmation page, and how to make this
page generic (template tag, read value from session)...

would anyone have an idea?

Thanks for your help,

-Fabien

Re: Confirmation page

Posted by Peter Alfors <pe...@irista.com>.
If you do not need to pass any information back to the previous page,
then you could use a standard javascript call as your cancel link.

<A href="javascript:history.go(-1)">CANCEL</A>

However, this requires that the user has a javascript enabled browser
(and does not have it turned off).
If you cannot guarantee this, you may want to avoid this approach.

Another approach would be to place the return URL into the request in
your ConfirmPageAction class.
Then the page can simply retrieve it as a request attribute when the
page is created.

HTH,
    Pete



Fabien Modoux wrote:

> Hello,
>
> I am new to Struts and I am struggling on what would
> be the best way to do the following:
>
> on several pages, the user can perform actions which
> need to be confirmed before being actually performed
> (e.g., exiting the application or logging off). The
> confirmation page is the same regardless of the calling
> point, but if the user cancels, I need to go back to
> the previous page. I am not sure how to pass the return
> url to the confirmation page, and how to make this
> page generic (template tag, read value from session)...
>
> would anyone have an idea?
>
> Thanks for your help,
>
> -Fabien

Re: Confirmation page

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 17 Apr 2001, Fabien Modoux wrote:

> Hello,
> 
> I am new to Struts and I am struggling on what would
> be the best way to do the following:
> 
> on several pages, the user can perform actions which
> need to be confirmed before being actually performed
> (e.g., exiting the application or logging off). The
> confirmation page is the same regardless of the calling
> point, but if the user cancels, I need to go back to
> the previous page. I am not sure how to pass the return
> url to the confirmation page, and how to make this
> page generic (template tag, read value from session)...
> 
> would anyone have an idea?
> 
> Thanks for your help,
> 
> -Fabien
> 

I would pass the URI of the page to be returned to as a request parameter
to the confirmation action.  This could be done as a query parameter on
the hyperlink (if you are clicking a link to request the logoff or
whatever) or as a hidden variable in the input form.

Craig