Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Returning to previous page  RSS feed

 
Alan Richardson
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,

This seems to be a relatively simple problem but being somewhat new to JSP I'm not sure how this is typically handled.

Basically is there a way in JSP to return to the previous page (rather than using Javascript)? I want to place 'Back' buttons on pages, and more importantly I have an error-handling page, which in some circumstances I would like to return the user to the page they were previously viewing.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could store your own history stack in session and add a link to the previous page from the stack to each page.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is also the "referer" header variable.
 
Alan Richardson
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ben

The referer variable is exactly what I need
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!