You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Shunhui Zhu <sh...@netvmg.com> on 2001/05/22 01:21:02 UTC
Referer pages and structs
Hi, I'm wondering whether Structs can be used to solve the following
problem elegantly.
I have a page, say contact.jsp that has two standard actions associated
to it: EditContactAction, SaveContactAction.
This page can be linked from many other pages. What I'd like is to go
back to the page that called contact.jsp.
For example, if page1 has a link to contact.jsp, after the user clicked
the link, then press the save button on the
contact.jsp, I'd like the next page to be page1. Similarly for all other
pages linking to contact.jsp. Is there a way to code
contact.jsp to automatically have this behavior?
Thanks.
Shunhui
Re: Referer pages and structs
Posted by Kevin Bedell <kb...@yahoo.com>.
A couple other ideas:
- Store the callback URL on the request object
- Store it in a bean that can be accessed by the
contacts page
I've used the second approach succcessfully on
Registration page where the user could register from
the site from a number of different areas...
--- Martin Cooper <ma...@tumbleweed.com>
wrote:
> You need to embed the source information in
> contact.jsp. Depending on how
> your Action classes are set up, you could do one of
> two things:
>
> 1) Use a hidden field on contact.jsp which
> identifies the source. Then when
> the form is submitted, your Action class can use
> that to select an
> appropriate forward. Using the name of the forward
> as the value of the
> hidden field would make this very simple.
>
> 2) Dynamically set the action attribute on the
> <html:form> tag when
> contact.jsp is processed, setting up the appropriate
> target for the page.
>
> Hope this helps.
>
> --
> Martin Cooper
>
>
> ----- Original Message -----
> From: "Shunhui Zhu" <sh...@netvmg.com>
> To: <st...@jakarta.apache.org>
> Sent: Monday, May 21, 2001 4:21 PM
> Subject: Referer pages and structs
>
>
> Hi, I'm wondering whether Structs can be used to
> solve the following
> problem elegantly.
>
> I have a page, say contact.jsp that has two standard
> actions associated
> to it: EditContactAction, SaveContactAction.
> This page can be linked from many other pages. What
> I'd like is to go
> back to the page that called contact.jsp.
> For example, if page1 has a link to contact.jsp,
> after the user clicked
> the link, then press the save button on the
> contact.jsp, I'd like the next page to be page1.
> Similarly for all other
> pages linking to contact.jsp. Is there a way to code
>
> contact.jsp to automatically have this behavior?
>
> Thanks.
>
> Shunhui
>
>
>
>
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
Re: Referer pages and structs
Posted by Martin Cooper <ma...@tumbleweed.com>.
You need to embed the source information in contact.jsp. Depending on how
your Action classes are set up, you could do one of two things:
1) Use a hidden field on contact.jsp which identifies the source. Then when
the form is submitted, your Action class can use that to select an
appropriate forward. Using the name of the forward as the value of the
hidden field would make this very simple.
2) Dynamically set the action attribute on the <html:form> tag when
contact.jsp is processed, setting up the appropriate target for the page.
Hope this helps.
--
Martin Cooper
----- Original Message -----
From: "Shunhui Zhu" <sh...@netvmg.com>
To: <st...@jakarta.apache.org>
Sent: Monday, May 21, 2001 4:21 PM
Subject: Referer pages and structs
Hi, I'm wondering whether Structs can be used to solve the following
problem elegantly.
I have a page, say contact.jsp that has two standard actions associated
to it: EditContactAction, SaveContactAction.
This page can be linked from many other pages. What I'd like is to go
back to the page that called contact.jsp.
For example, if page1 has a link to contact.jsp, after the user clicked
the link, then press the save button on the
contact.jsp, I'd like the next page to be page1. Similarly for all other
pages linking to contact.jsp. Is there a way to code
contact.jsp to automatically have this behavior?
Thanks.
Shunhui