how to go to the previous page in struts
I have a login page through this page i can navigate to any page . I have a invoice page which can come from two or three pages. in invoice page i have a back button . If i press this back button it should go to the page where i came from(previous page).and i have other buttons like Reprint and renew . I need to enable this button or disable it depending from which page i come from how can i do this .If you explain me with an example I would really appreciate it.
[474 byte] By [
SubhaMania] at [2007-11-27 9:55:35]

# 1
i use servlet rather than jsp/struts but the capabilities are the same even though the model is slightly different.
The problem is that a user should only ever goto a login page if they are not logged in.
you can use
session.setAttribute("lastpage", currentURL);
on every single page the user visits - except for the login page (and confirmation pages ect).
Then on the login page use logic such as
if (userAlreadyLoggedIn)
{
req.sendRedirect(session.getAttribute("lastpage"));
}
Therefore, whether the login page is requested by your back button or by any other means, the user is redirected to the page they 'should' by on
Bamkin