• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to redirect to the page where the user come from  RSS feed

 
zhiqiang yang
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
many pages have the link to the page of "login.jsp", when user input the right name and password, i want to send to user to the page where he come from. any ideas?

Thanks!
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The easiest way would probabely be to include the referring JSP as a parameter in the link to the login page.

For example if a.jsp has a link to login.jsp, make it something like

and then retrieve that parameter in login.jsp to redirect back to the original page.

HTH
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that is in fact just about the only way unless you already have a session in which to keep track of things (and even then you can only keep track of servlets and jsps you specifically code to do so).
I've done this once in an application where the customer wanted a trace of the last 3 visited pages in the application (with option to go back 3 steps from anywhere). Was a mess (especially deciding when to discard what data set in the session depending on which pages had been visited before) but we got it working.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!