Struts mapping recap
Here is a sample stuts action mapping:-
<form-bean name="TestForm" type="com.test.form.TestForm">
<action path="/Test" parameter="action" type="com.test.action.TestAction" scope="request" validate="false" name="TestForm">
<forward name="list" path="/web/jsp/test.jsp" redirect="false">
The name parameter is what tells what is the form.
In the above the parameter action is what defines where the execution of the struts dispatch action will go to.
For example /Test?list will go a method called list in the Test Dispatch action.
There is only one forward above with the same name list, so mapping.findforward("list"), will forward to "
If it were to be redirect=true, the conatiner would forward the "
In short instead of just a forward to test.jsp , it forwards to test.jsp and then forces the browser to submit test.jsp again.
Internally this is done using two diffetent serlet api methods.
The forward is done using the requestdispatcher forward method
The redirect is done using the sendRedirect method of the http response object.
Needless to say whatever was there in the first request scope will be lost.One way to not loose pervious request data is the use of hidden variables back and forth but this can be very cumbersome.