You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James Howe <jw...@allencreek.com> on 2001/04/30 20:43:46 UTC
Returning from a form apge
In our web application, we have two pages from which a user can access a
third page. From the third page (which is form to fill out and save), the
user either saves or cancels their action, and the user is returned to the
page from which they originally started. However, the third page has no
knowledge about where it came from so it doesn't no who to forward to when
its action is complete.
I'm not sure how best to handle this situation. One option would be to use
a parameter on the link to the third page with a value indicating the page
to return to. However, I'm using an <html:link> tag which is passing other
object related parameters on to the third screen (the form uses this
information to populate itself). What I would like to do is get the
parameters from the object and then append another parameter which
indicates the page to return to but I can't do that and use the link
tag. I'm toying with the idea of building a custom link tag which also
takes a "return" attribute. This tag would put the return information in
the parameter list that gets generated. Before I do that, however, I'm
wondering what other ways people have used to address this sort of problem?
(I assume that I'm not the only person to have encoutered this situation)
Any tips or suggestions would be appreciated.
Thanks.
Re: Returning from a form apge
Posted by John Raley <jo...@moonlight.com>.
This is one instance of what I consider an large, unaddressed problem: how an
application links its pages together. I ended up writing a whole framework
for self-linking with parameters. I'm really happy with it but I was
surprised that I had to build it in the first place. Maybe there's something
out there I don't know about?
James, I think you're correct to solve this problem by adding a "return to"
parameter to the link. If you use the "name" attribute of <html:link>, you
can pass an arbitrary number of parameters in a Map. Will this work for you?
James Howe wrote:
> In our web application, we have two pages from which a user can access a
> third page. From the third page (which is form to fill out and save), the
> user either saves or cancels their action, and the user is returned to the
> page from which they originally started. However, the third page has no
> knowledge about where it came from so it doesn't no who to forward to when
> its action is complete.
>
> I'm not sure how best to handle this situation. One option would be to use
> a parameter on the link to the third page with a value indicating the page
> to return to. However, I'm using an <html:link> tag which is passing other
> object related parameters on to the third screen (the form uses this
> information to populate itself). What I would like to do is get the
> parameters from the object and then append another parameter which
> indicates the page to return to but I can't do that and use the link
> tag. I'm toying with the idea of building a custom link tag which also
> takes a "return" attribute. This tag would put the return information in
> the parameter list that gets generated. Before I do that, however, I'm
> wondering what other ways people have used to address this sort of problem?
> (I assume that I'm not the only person to have encoutered this situation)
>
> Any tips or suggestions would be appreciated.
>
> Thanks.
RE: Returning from a form page
Posted by James Howe <jw...@allencreek.com>.
Thanks for the tip. I had considered doing something like that but somehow
convinced myself that it probably wouldn't work before even giving it a try.
At 02:42 PM 4/30/2001 -0700, you wrote:
>If you hard code a parameter into the href or page attribute of
><html:link>, it is smart enough to know how to append the other
>parameters contained in your parameter map. For example if your page
>value is "/myForm.do?ref=1", and your parameter map contains
>the pairs param1=abc and param2=def, <html:link> will correctly form the URL:
>
>http://www.mycompany.com/myApp/myForm.do?ref=1¶m1=abc¶m2=def
>
>
>-----Original Message-----
>From: James Howe [mailto:jwh@allencreek.com]
>Sent: Monday, April 30, 2001 11:44 AM
>To: struts-user@jakarta.apache.org
>Subject: Returning from a form apge
>
>
>In our web application, we have two pages from which a user can access a
>third page. From the third page (which is form to fill out and save), the
>user either saves or cancels their action, and the user is returned to the
>page from which they originally started. However, the third page has no
>knowledge about where it came from so it doesn't no who to forward to when
>its action is complete. [...]
James W. Howe mailto:jwh@allencreek.com
Allen Creek Software, Inc. pgpkey: http://ic.net/~jwh/pgpkey.html
Ann Arbor, MI 48103
RE: Returning from a form apge
Posted by Eric Butterfield <er...@msoft.com>.
If you hard code a parameter into the href or page attribute of <html:link>, it is smart enough to know how to append the other
parameters contained in your parameter map. For example if your page value is "/myForm.do?ref=1", and your parameter map contains
the pairs param1=abc and param2=def, <html:link> will correctly form the URL:
http://www.mycompany.com/myApp/myForm.do?ref=1¶m1=abc¶m2=def
-----Original Message-----
From: James Howe [mailto:jwh@allencreek.com]
Sent: Monday, April 30, 2001 11:44 AM
To: struts-user@jakarta.apache.org
Subject: Returning from a form apge
In our web application, we have two pages from which a user can access a
third page. From the third page (which is form to fill out and save), the
user either saves or cancels their action, and the user is returned to the
page from which they originally started. However, the third page has no
knowledge about where it came from so it doesn't no who to forward to when
its action is complete.
I'm not sure how best to handle this situation. One option would be to use
a parameter on the link to the third page with a value indicating the page
to return to. However, I'm using an <html:link> tag which is passing other
object related parameters on to the third screen (the form uses this
information to populate itself). What I would like to do is get the
parameters from the object and then append another parameter which
indicates the page to return to but I can't do that and use the link
tag. I'm toying with the idea of building a custom link tag which also
takes a "return" attribute. This tag would put the return information in
the parameter list that gets generated. Before I do that, however, I'm
wondering what other ways people have used to address this sort of problem?
(I assume that I'm not the only person to have encoutered this situation)
Any tips or suggestions would be appreciated.
Thanks.
RE: Returning from a form apge
Posted by Lewis Henderson <Le...@CobraFlow.com>.
Thx,
My idea was to allow multi-level popup.
Jsp1 => Jsp2 => Jsp3
Jsp1 <= Jsp2 => Jsp3
...or any combination...
Lewis
-----Original Message-----
From: Peter Alfors [mailto:peter.alfors@irista.com]
Sent: 30 April 2001 20:41
To: struts-user@jakarta.apache.org
Subject: Re: Returning from a form apge
The request contains the referring page.
request.getHeader("Referer")
Therefore, your action class for the 3rd page could look up where he came
from
in the request.
HTH,
Pete
Lewis Henderson wrote:
> Hi,
>
> I also have a similar issue...a reuseable popup...
>
> The problem with your passing the return page as a parameter is that you
can
> only nest to one level...
>
> I am thinking of writing a 'push'/'pop'/'peek' implementation to allow
this
> to occur...
>
> Does anyone have any comments/ideas.
>
> Lewis
>
> -----Original Message-----
> From: James Howe [mailto:jwh@allencreek.com]
> Sent: 30 April 2001 19:44
> To: struts-user@jakarta.apache.org
> Subject: Returning from a form apge
>
> In our web application, we have two pages from which a user can access a
> third page. From the third page (which is form to fill out and save), the
> user either saves or cancels their action, and the user is returned to the
> page from which they originally started. However, the third page has no
> knowledge about where it came from so it doesn't no who to forward to when
> its action is complete.
>
> I'm not sure how best to handle this situation. One option would be to
use
> a parameter on the link to the third page with a value indicating the page
> to return to. However, I'm using an <html:link> tag which is passing
other
> object related parameters on to the third screen (the form uses this
> information to populate itself). What I would like to do is get the
> parameters from the object and then append another parameter which
> indicates the page to return to but I can't do that and use the link
> tag. I'm toying with the idea of building a custom link tag which also
> takes a "return" attribute. This tag would put the return information in
> the parameter list that gets generated. Before I do that, however, I'm
> wondering what other ways people have used to address this sort of
problem?
> (I assume that I'm not the only person to have encoutered this situation)
>
> Any tips or suggestions would be appreciated.
>
> Thanks.
Re: Returning from a form apge
Posted by Peter Alfors <pe...@irista.com>.
The request contains the referring page.
request.getHeader("Referer")
Therefore, your action class for the 3rd page could look up where he came from
in the request.
HTH,
Pete
Lewis Henderson wrote:
> Hi,
>
> I also have a similar issue...a reuseable popup...
>
> The problem with your passing the return page as a parameter is that you can
> only nest to one level...
>
> I am thinking of writing a 'push'/'pop'/'peek' implementation to allow this
> to occur...
>
> Does anyone have any comments/ideas.
>
> Lewis
>
> -----Original Message-----
> From: James Howe [mailto:jwh@allencreek.com]
> Sent: 30 April 2001 19:44
> To: struts-user@jakarta.apache.org
> Subject: Returning from a form apge
>
> In our web application, we have two pages from which a user can access a
> third page. From the third page (which is form to fill out and save), the
> user either saves or cancels their action, and the user is returned to the
> page from which they originally started. However, the third page has no
> knowledge about where it came from so it doesn't no who to forward to when
> its action is complete.
>
> I'm not sure how best to handle this situation. One option would be to use
> a parameter on the link to the third page with a value indicating the page
> to return to. However, I'm using an <html:link> tag which is passing other
> object related parameters on to the third screen (the form uses this
> information to populate itself). What I would like to do is get the
> parameters from the object and then append another parameter which
> indicates the page to return to but I can't do that and use the link
> tag. I'm toying with the idea of building a custom link tag which also
> takes a "return" attribute. This tag would put the return information in
> the parameter list that gets generated. Before I do that, however, I'm
> wondering what other ways people have used to address this sort of problem?
> (I assume that I'm not the only person to have encoutered this situation)
>
> Any tips or suggestions would be appreciated.
>
> Thanks.
RE: Returning from a form apge
Posted by Lewis Henderson <Le...@CobraFlow.com>.
Hi,
I also have a similar issue...a reuseable popup...
The problem with your passing the return page as a parameter is that you can
only nest to one level...
I am thinking of writing a 'push'/'pop'/'peek' implementation to allow this
to occur...
Does anyone have any comments/ideas.
Lewis
-----Original Message-----
From: James Howe [mailto:jwh@allencreek.com]
Sent: 30 April 2001 19:44
To: struts-user@jakarta.apache.org
Subject: Returning from a form apge
In our web application, we have two pages from which a user can access a
third page. From the third page (which is form to fill out and save), the
user either saves or cancels their action, and the user is returned to the
page from which they originally started. However, the third page has no
knowledge about where it came from so it doesn't no who to forward to when
its action is complete.
I'm not sure how best to handle this situation. One option would be to use
a parameter on the link to the third page with a value indicating the page
to return to. However, I'm using an <html:link> tag which is passing other
object related parameters on to the third screen (the form uses this
information to populate itself). What I would like to do is get the
parameters from the object and then append another parameter which
indicates the page to return to but I can't do that and use the link
tag. I'm toying with the idea of building a custom link tag which also
takes a "return" attribute. This tag would put the return information in
the parameter list that gets generated. Before I do that, however, I'm
wondering what other ways people have used to address this sort of problem?
(I assume that I'm not the only person to have encoutered this situation)
Any tips or suggestions would be appreciated.
Thanks.