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

bamkin-ov-lestaa at 2007-7-13 0:25:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Do not set the "lastUrl" in session , instead set it in request scope or in the Form Bean . If u set it in session remove it from session after you are done with it.
vinayak_ra at 2007-7-13 0:25:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...