0

I'm upgrading our application from an old version of struts to the latest '1' version: 1.3.10. Now, our code that attempts to process the Action is always getting back a null forward object. I attached the struts source code, and it looks like it ALWAYS returns null. Prior to upgrading our code worked fine and the forward object was populated when it returned.

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

Now, here's the Struts code for processActionPerform:

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));
    }
}

As you can see, this calls the Action execute method. Below is the Struts execute method code, which you can see always returns null.

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

I'm wondering if I need to change to use a different Struts class or method to get this to work. Any assistance would be appreciated.

Thanks!

LuckyJack2001
  • 11
  • 1
  • 4
  • Your `action` should point to an instance of a **subclass** of `Action` that **overrides** `execute()`. – ericbn Oct 21 '14 at 19:26
  • No, cannot do that. It is the Struts class 'RequestProcessor' that calls Action.execute - I have no control over that. Struts should be able to handle this by itself without me having to write a sub-class. It worked perfectly before with the exact same code - only difference is a later version of Struts. – LuckyJack2001 Oct 21 '14 at 19:53
  • I don't understand. You're showing Struts code, which is not relevant; you need to show *your* code, *your* configuration, etc. which is what will *actually* be executed. All you're showing us is code that returns `null`, and it would do that regardless of the S1 version you're using. – Dave Newton Oct 22 '14 at 14:09

1 Answers1

0

Ericbn is actually correct - my apologies, Eric. Yes, I needed to override the execute method in my Action classes. They currently override 'perform', which was removed from the Action class (formerly deprecated). Thanks! Paul

LuckyJack2001
  • 11
  • 1
  • 4