Struts Action类的execute方法总是返回null。 Struts 1.3.10

时间:2014-10-21 18:40:19

标签: java struts1

我正在将我们的应用程序从旧版本的struts升级到最新的'1'版本:1.3.10。 现在,我们尝试处理Action的代码总是返回一个null前向对象。我附加了struts源代码,看起来它总是返回null。在升级之前,我们的代码工作正常,并且在返回时填充了前向对象。

    forward = super.processActionPerform(request, response, action, formInstance, mapping); 
    return (forward);

现在,这是processActionPerform的 Struts代码

protected ActionForward processActionPerform(HttpServletRequest request,
    HttpServletResponse response, Action action, ActionForm form,
    ActionMapping mapping)
    throws IOException, ServletException {
    try {
        return (action.execute(mapping, form, request, response));
    } catch (Exception e) {
        return (processException(request, response, e, form, mapping));
    }
}

如您所见,这将调用Action执行方法。下面是Struts执行方法代码,您可以看到它始终返回null。

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

我想知道我是否需要更改以使用不同的Struts类或方法来实现此功能。任何帮助将不胜感激。

谢谢!

1 个答案:

答案 0 :(得分:0)

埃里克实际上是正确的 - 我的道歉,埃里克。是的,我需要覆盖Action类中的execute方法。它们当前覆盖'perform',它已从Action类(以前不推荐使用)中删除。 谢谢! 保罗

相关问题