views:

20

answers:

1

I want to redirect to the previous page from Log In page after user logged in. The problem is the previous JSP page was requested by form submitting(with Post method) and the previous JSP need the data submitted to do some logic. What's the best way to return to previous page without missing the data that has submitted by Post method? Thanks in advance!

a.jsp(post form submit) ---> b.jsp (click login button) ---> login.jsp (return to previous)
                                           |                       |
                                           +-----------------------+
A: 

You could simply include a hidden field in your form called 'referrer' and set it when user get redirected to this page with the Request referrer, in your login bean you would check if the form refferer have been set if so redirect back to that page. As for the post data you could store it in session before redirecting to login page and then populate field value from session when you return to that page after login.

I hope I did understand your question correctly.

Greg
Thanks Greg, i hope my question is clear. please look at my diagram.
didxga