服务器和客户端通信过程中的任何一步是否删除了HttpServletRequest?
Is HttpServletRequest deleted in any step of the comunication process between server and client?
我有两个方法。 Method1 创建 ActionErrors,它对 Method2 执行 findForward();然后 Method2 findForward() 到 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);
}
编辑 1:
当被问及上一个问题时,我感到困惑。所以我会安排它请另一个人来澄清我自己 ^^'。
我知道从另一个调用方法的 3 种方法:
mapping.findForward("method2"):
< forward name="method2" path="/path/to/method2"/>
return到另一种方法:
public ActionForward method1(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) {
//stuff
return method2(mapping, form, request, response);
}
- 从 jsp 使用 ajax 或其他
是的,当向客户端发送响应时,请求在服务器中丢失了。
我有两个方法。 Method1 创建 ActionErrors,它对 Method2 执行 findForward();然后 Method2 findForward() 到 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);
}
编辑 1: 当被问及上一个问题时,我感到困惑。所以我会安排它请另一个人来澄清我自己 ^^'。 我知道从另一个调用方法的 3 种方法:
mapping.findForward("method2"):
< forward name="method2" path="/path/to/method2"/>
return到另一种方法:
public ActionForward method1(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) { //stuff return method2(mapping, form, request, response); }
- 从 jsp 使用 ajax 或其他
是的,当向客户端发送响应时,请求在服务器中丢失了。