You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Brendan Grainger <bg...@nyc.rr.com> on 2003/03/12 05:29:43 UTC

How do I return to the calling page? Tiles and Struts

Hi,

I have a small site built with Tiles and Struts. On each page I have a
standard left navigation. At the bottom of the navigation is a login box.
What I'd like to do is have the user be able to login on any page on my site.
On successful login, I just want to return the user to the page they were on
before logging in (the login box will just change to "Welcome you're logged
in" - or something like that). The problem I have is that all pages are
defined using Tiles definitions and I use Struts to forward to a definition.
In the execute method in the LogonAction I have access to the following:

request.getRequestURL(): http://localhost:8080/webwork/logon.do
request.getRequestURI(): /webwork/logon.do
request.getContextPath(): /webwork
request.getPathInfo():null
request.getPathTranslated();null
mapping.getInput()null
mapping.getName()logonForm
mapping.getPath()/logon

If the last page was actually something like articles.do or editArticles.do
how can I find that out in the LoginAction class and return the user to that
page?

Thanks
BJ
-------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: How do I return to the calling page? Tiles and Struts

Posted by Brendan Grainger <bg...@nyc.rr.com>.
Hi Patrick,

Thanks for your response. The problem is using Tiles with this code on the jsp 
page:

Test: <%=request.getRequestURI() %>
Test: <%=request.getRequestURL() %> 

I get result:

Test: /webwork/template/base.jsp
Test: http://localhost:8080/webwork/index.jsp

I could use a hidden field as you said (and actually have tried that), but 
what I really need is a method of getting the Tiles definition used to 
construct the page so that I can just forward back to that page.

Thanks 


On Tuesday 11 March 2003 11:49 pm, Patrick Willart wrote:
> You can add a hidden field with the page location in your logonForm. If you
> store this value in the session you can test for it on your success page
> and redirect to it.
>
> I am not sure if this works. I am actually thinking of using struts myself
> for a redesign of our website. Right now I am using this solution without
> Struts.
>
> If you find a good solution or may just have to live with it I would like
> to know. If it doesn't work for you I may choose to build a simple MVC
> design with servlets and JSPs.
>
> Patrick
> ----- Original Message -----
> From: "Brendan Grainger" <bg...@nyc.rr.com>
> To: <st...@jakarta.apache.org>
> Sent: Tuesday, March 11, 2003 8:29 PM
> Subject: How do I return to the calling page? Tiles and Struts
>
> > Hi,
> >
> > I have a small site built with Tiles and Struts. On each page I have a
> > standard left navigation. At the bottom of the navigation is a login box.
> > What I'd like to do is have the user be able to login on any page on my
>
> site.
>
> > On successful login, I just want to return the user to the page they were
>
> on
>
> > before logging in (the login box will just change to "Welcome you're
>
> logged
>
> > in" - or something like that). The problem I have is that all pages are
> > defined using Tiles definitions and I use Struts to forward to a
>
> definition.
>
> > In the execute method in the LogonAction I have access to the following:
> >
> > request.getRequestURL(): http://localhost:8080/webwork/logon.do
> > request.getRequestURI(): /webwork/logon.do
> > request.getContextPath(): /webwork
> > request.getPathInfo():null
> > request.getPathTranslated();null
> > mapping.getInput()null
> > mapping.getName()logonForm
> > mapping.getPath()/logon
> >
> > If the last page was actually something like articles.do or
>
> editArticles.do
>
> > how can I find that out in the LoginAction class and return the user to
>
> that
>
> > page?
> >
> > Thanks
> > BJ
> > -------------------------------------------------------
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: How do I return to the calling page? Tiles and Struts

Posted by Patrick Willart <pa...@aptitudexchange.com>.
You can add a hidden field with the page location in your logonForm. If you
store this value in the session you can test for it on your success page and
redirect to it.

I am not sure if this works. I am actually thinking of using struts myself
for a redesign of our website. Right now I am using this solution without
Struts.

If you find a good solution or may just have to live with it I would like to
know. If it doesn't work for you I may choose to build a simple MVC design
with servlets and JSPs.

Patrick
----- Original Message -----
From: "Brendan Grainger" <bg...@nyc.rr.com>
To: <st...@jakarta.apache.org>
Sent: Tuesday, March 11, 2003 8:29 PM
Subject: How do I return to the calling page? Tiles and Struts


> Hi,
>
> I have a small site built with Tiles and Struts. On each page I have a
> standard left navigation. At the bottom of the navigation is a login box.
> What I'd like to do is have the user be able to login on any page on my
site.
> On successful login, I just want to return the user to the page they were
on
> before logging in (the login box will just change to "Welcome you're
logged
> in" - or something like that). The problem I have is that all pages are
> defined using Tiles definitions and I use Struts to forward to a
definition.
> In the execute method in the LogonAction I have access to the following:
>
> request.getRequestURL(): http://localhost:8080/webwork/logon.do
> request.getRequestURI(): /webwork/logon.do
> request.getContextPath(): /webwork
> request.getPathInfo():null
> request.getPathTranslated();null
> mapping.getInput()null
> mapping.getName()logonForm
> mapping.getPath()/logon
>
> If the last page was actually something like articles.do or
editArticles.do
> how can I find that out in the LoginAction class and return the user to
that
> page?
>
> Thanks
> BJ
> -------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org