开发者

Struts Action class execute() method........mapping.findForward('null')

开发者 https://www.devze.com 2023-01-30 17:43 出处:网络
In my struts application i want to pass the null value to the mapping.findForward(\'null\') the reason to do this is that i do not want to call any jsp page

In my struts application i want to pass the null value to the mapping.findForward('null') the reason to do this is that i do not want to call any jsp page

More details

public ActionForward saveSurveyTakersDetails(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws Ex开发者_运维知识库ception
    { 
     // something
     return mapping.findForward(null);
     }

Is it is valid to pass null at findForward parameter.. Please answer thanks


It's no problem returning null in an action to prevent redirecting to a JSP page, but I would suggest leaving out the findForward() call and just return null outright:

public ActionForward saveSurveyTakersDetails(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception { 
    // something
    return null;
}

It will have the same result, but is a little easier understand at a glance.


Simply returning null (as opposed to finding a forward of "null") from the saveSurveyTakersDetails method should accomplish what you are attempting.

0

精彩评论

暂无评论...
验证码 换一张
取 消