Search code examples
javarequeststruts-1

Is HttpServletRequest deleted in any step of the comunication process between server and client?


I have two methods. Method1 creates ActionErrors and it does a findForward() to Method2; then Method2 findForward() to a jsp.

public ActionForward method1(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) {
   //stuff
   ActionErrors errors = new ActionErrors();
   errors.add("myError", new ActionError("myError"));
   saveErrors(request, errors);   
   return mapping.findForward(method2);
}

//...
//properly configured struts config file
//...

public ActionForward method2(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) {
  //stuff
  return mapping.finForward(myJsp);
}

EDIT 1: I was confused when asked the previous question. So I'll arrange it asking another to clarify myself ^^'. I know 3 ways to call a method from another:

  1. mapping.findForward("method2"):

    < forward name="method2" path="/path/to/method2"/>

  2. return to another method:

    
    public ActionForward method1(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) {
            //stuff   
            return method2(mapping, form, request, response);
    }
    
    
    1. From jsp using ajax or whatever

Solution

  • Yes, the request is lost in the server when sending response to the client.