Hi
i am now engaged in software development involving struts
framework.now i want to display some results processed in the first
action and then forward to second action.where the same processing is
carried out and the result is to be displayed in the form of a
string.how is this possible? i have used RequestDispatcher object,but
the program is still not working .pls do hepl me
Markus - 22 Nov 2005 11:35 GMT
Try this:
In struts-config.xml define an forward for the first action named
success which points to the second action.
If you return arg0.findForward("success") (arg0 = ActionMapping) your
Request will be forwarded to the next Action.
Example:
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
//Forwards the Request to the Action defined in struts-config.xml under
TestAction.
public class TestAction extends Action {
public ActionForward execute(
ActionMapping arg0,
ActionForm arg1,
HttpServletRequest arg2,
HttpServletResponse arg3)
throws IOException, ServletException {
return arg0.findForward("success");
}
}