• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I get correct backto page?

 
Jingh Yi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm new here. I need your help with the browser back button. The sequence of the jsp pages are: page 1 -> page 2 -> page 3. On page 2, there is an 'Export to Excel' button. When user clicks on it, it goes back to the servlet and generate an Excel file and downloads it to jsp page 3. Then when user clicks on the Browser back button on page 3, it does not go back to page 2, it goes back to page 1 instead. How can I control the 'backto' page on jsp page 3, which is the excel file page? It is obviously treated as page 2.

Thanks!
Jenny
 
Ganeshji Marwaha
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a quick hack would be to use response.sendRedirect in ur servlet to get to the JSP page so that page 3 is treated as it should be... I am assuming that the servlet forwards the request to page 3 using requestdispatcher...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Ganesh M",

We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
Jingh Yi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ganesh,

Thanks for your reply. I did try to use redirect and it didn't work. The erro message I got is:

Exception happened:
com.ibm.servlet.engine.webapp.WebAppErrorReport:
Please call the System Administrator.

The reason is that, we are using STRUTS framework. Every action has to return ActionForward from the executeBody() method. In order to use the redirect, I had to return null for that method and it caused this error.

Any solutions for that?

Thanks,
Jenny
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic