This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread 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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
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: 60741
    
  65

"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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by 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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How can I get correct backto page?
 
Similar Threads
How do I get to user response.redirect from Struts?
Questions of J2EE pattern and Struts
display csv file as an excel in java
Rendering Excel spreadsheet in JSP OR via CSV File Download
Save excel file by hitting a url