| Author |
going back
|
Sarathy Srinivas
Greenhorn
Joined: Jan 08, 2008
Posts: 7
|
|
Hi, I have a problem with page redirection. On my site I have a page that can be reached through several other pages (change profile page). This page has several options changemail id, password .. etc. I need to find a way to redirect to the page where the change profile link was clicked .. i.e back to that page. (as a link or button, doesnt matter). Under normal circumstances i would be able to do this with the history.go(x) but as i cant predict how many pages back since the user can do many form submissions and redirections from the cahnge profile page. So, is there anyway to store the value of the previous page the moment i come to the change profile page or can i store the value of history.go() in some way.. Thanks in advance.
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12325
|
|
If the link to the change profile page is always a POST from a form you can use a hidden variable to let the profile page know how the user got there and thus provide for returning to the right page. Bill
|
Java Resources at www.wbrogden.com
|
 |
Sarathy Srinivas
Greenhorn
Joined: Jan 08, 2008
Posts: 7
|
|
@ William.. there are many ways to reach the page. Your method would involve doing this for all the links to that page. this is something that, though possible, im looking to avoid. Is there a way to check the request parameter? If so what method should i use? [ February 18, 2008: Message edited by: Sarathy Srinivas ]
|
 |
Qussay Najjar
Ranch Hand
Joined: Jan 18, 2008
Posts: 53
|
|
Originally posted by Sarathy Srinivas: @ William.. there are many ways to reach the page. Your method would involve doing this for all the links to that page. this is something that, though possible, im looking to avoid. Is there a way to check the request parameter? If so what method should i use? [ February 18, 2008: Message edited by: Sarathy Srinivas ]
here is some code that I've applied in one of my applications, you'll see the important parts of it: link in page1.jsp link in page2.jsp and so forth.. in page editProfile.jsp in servlet ProfileEditor inside doPost(request, response) Honestly speaking, I don't know if it's a professional way to deal with such trick, but this is only what I did to solve it that time.. hope it helps...
|
Qussay NAJJAR
|
 |
Qussay Najjar
Ranch Hand
Joined: Jan 18, 2008
Posts: 53
|
|
Originally posted by Qussay Najjar: in page editProfile.jsp
sorry for my mistake, the code in quote should be like this:
|
 |
 |
|
|
subject: going back
|
|
|