You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Karin Schellner <ka...@researchstudio.at> on 2005/08/19 15:37:27 UTC
dynamic forward path?
Hi,
I am new to Struts and would appreciate your ideas for a solution to the
following problem:
In my webapplication I have a login-form with a submit and cancel
button. When the user clicks the cancel-button I would like to return
him to the page he previously visited (before calling the page with the
login-form). Using a forward in the action-mapping would redirect the
user always to the same page (e.g. welcome.do), therefore I was thinking
of storing the last visited page in the session and use it for a
redirect, but then I would bypass the struts-config ... what do you
think? Is there a possibility to achieve this in Struts?
thanks,
karin.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: dynamic forward path?
Posted by Karin Schellner <ka...@researchstudio.at>.
thanks for this idea; I implemented it the way you suggested - with this
solution everything is still configurable through the struts-config file
as you are stating below ...
thanks a lot,
karin.
Laurie Harper wrote:
> Karin Schellner wrote:
>
>> I am new to Struts and would appreciate your ideas for a solution to
>> the following problem:
>>
>> In my webapplication I have a login-form with a submit and cancel
>> button. When the user clicks the cancel-button I would like to return
>> him to the page he previously visited (before calling the page with
>> the login-form). Using a forward in the action-mapping would redirect
>> the user always to the same page (e.g. welcome.do), therefore I was
>> thinking of storing the last visited page in the session and use it
>> for a redirect, but then I would bypass the struts-config ... what do
>> you think? Is there a possibility to achieve this in Struts?
>
>
> The second option is the one you want. There's no way you can
> statically define a forward in struts-config that points to 'the page
> the user was on before this one'.
>
> What you could do, though, is create a ReturnToPreviousPage action
> which redirects to the URL you stored in the session and have an
> action forward in struts-config pointing to that action. You still
> have to keep track of where that action should redirect to yourself
> (though the session or whatever). The advantage is that your
> struts-config is still declaratively declaring the behaviour -- and
> you can then change the behaviour (e.g. to always forward to the
> application home page instead of the previous page) by modifying the
> config. You also get the option to re-use the ReturnToPreviousPage
> action anywhere else you need the same behaviour.
>
> HTH,
>
> L.
--
DI Karin Schellner
Research Studios Austria - Digital Memory Engineering
ARC Seibersdorf research GmbH
Thurngasse 8/20, A-1090 Wien
M. +43.664.825-1105
T. +43.1.585-0537
F. +43.1.585-3741
http://dme.researchstudio.at
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: dynamic forward path?
Posted by Laurie Harper <la...@holoweb.net>.
Karin Schellner wrote:
> I am new to Struts and would appreciate your ideas for a solution to the
> following problem:
>
> In my webapplication I have a login-form with a submit and cancel
> button. When the user clicks the cancel-button I would like to return
> him to the page he previously visited (before calling the page with the
> login-form). Using a forward in the action-mapping would redirect the
> user always to the same page (e.g. welcome.do), therefore I was thinking
> of storing the last visited page in the session and use it for a
> redirect, but then I would bypass the struts-config ... what do you
> think? Is there a possibility to achieve this in Struts?
The second option is the one you want. There's no way you can statically
define a forward in struts-config that points to 'the page the user was on
before this one'.
What you could do, though, is create a ReturnToPreviousPage action which
redirects to the URL you stored in the session and have an action forward
in struts-config pointing to that action. You still have to keep track of
where that action should redirect to yourself (though the session or
whatever). The advantage is that your struts-config is still declaratively
declaring the behaviour -- and you can then change the behaviour (e.g. to
always forward to the application home page instead of the previous page)
by modifying the config. You also get the option to re-use the
ReturnToPreviousPage action anywhere else you need the same behaviour.
HTH,
L.
--
Laurie Harper
Open Source advocate, Java geek: http://www.holoweb.net/laurie
Founder, Zotech Software: http://www.zotechsoftware.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org