Hi,
I got stuck with a very simple logic. This is explained below.
I have 3
JSP pages. Page 1 has a hyperlink which takes you to Page 2.Page 2 has a 'Next' button which takes you to Page 3. Now Page 3 again has 'Cancel','Previous' and 'Next' buttons.Clicking on Cancel shud take you to Page 2 with the default values of input fields whereas a Previous button should take you to Page 2 with the User settings restored(the input fields you wud have selected in Page 2).
My approach for the same is :
Clicking on a cancel button invlkes the below method.
function cancel_action()
{
document.form.hdnAction.value ="cancel";
document.form.action = "ShowPage2.do";
document.form.submit();
}
Clicking on Previous button wud invoke the below method .
function previous_action()
{
document.form.hdnAction.value = "previous";
document.form.action ="ShowPage2.do";
document.form.submit();
}
In my Action Class, i wud check for this 'hdnAction' and if its 'cancel' , i wud clear the remove the values stored in the session(so as to show the default values).
And in my Struts-config.xml , I wud set the scope of my action as 'session'
<action path="/ ShowPage2 " type="qualifiedpath.myAction"
input="/jsp/ Page1.jsp" scope="session">
<forward name="success" path="/jsp/../Page2jsp" />
</forward>
</action>
Will this suffice ? Am i missing something?
Thanks in Advance,
Priya