This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes How can I get correct backto page? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "How can I get correct backto page?" Watch "How can I get correct backto page?" New topic
Author

How can I get correct backto page?

Jingh Yi
Ranch Hand

Joined: Mar 23, 2005
Posts: 90
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

Joined: Sep 16, 2004
Posts: 27
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...


-- Ganeshji Marwaha<br />SCJP<br />SCWCD<br />SCBCD<br />MCP, MCP+SB, MCSD
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56150
    
  13

"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


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Jingh Yi
Ranch Hand

Joined: Mar 23, 2005
Posts: 90
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
 
I agree. Here's the link: http://jrebel.com/download
 
subject: How can I get correct backto page?
 
Similar Threads
How do I get to user response.redirect from Struts?
display csv file as an excel in java
Questions of J2EE pattern and Struts
Save excel file by hitting a url
Rendering Excel spreadsheet in JSP OR via CSV File Download