Search code examples
strutsstruts-1

When is 'mapping.getInputForward()' used?


I would like to know what mapping.getInputForward() does in Struts. The API says that it creates and returns an ActionForward that corresponds to the input of the Action.

But I don't understand what this means. Could anybody explain to me more clearly? Can I use this method to return to the previous page? And if I can, how do I do this?


Solution

  • getInputForward() does precisely what it says it does: it returns an ActionForward corresponding to the action's input attribute value.

    You probably wouldn't want to use it as a general "return to previous page", because that wouldn't make any sense. It's commonly used when calling validation "by hand" and there's a validation error; the input value would be the form page. In those cases it's similar to "return to previous page", but different, because it's generally a forward (not a redirect) to the form JSP.

    That said, it's just a normal findForward but for the action's input page.