struts-config.xml file - purpose of input

well actually picture well actually · Dec 10, 2011 · Viewed 10.8k times · Source

I am new to struts. I am wondering what input variable here signifies. After some googling, the only conclusive piece of info was this:

Input: The physical page (or another ActionMapping) to which control should be forwarded when validation errors exist in the form bean.

Is there any other use for the input parameter besides the case of an error occurring?

<action
   roles="somerole"
   path="some/path"
   type="some.java.class"
   name="somename"
   input="someInput"
   scope="request"
   validate="false"
   parameter="action">
   <forward name="success" path="some/path"/>
   <forward name="download" path="/another/path"/>
</action>

Answer

Dave Newton picture Dave Newton · Dec 10, 2011

Yes, although you're correct that it's primarily a forward for failed validation.

The input has a dedicated method to return it: ActionMapping.getInputForward(). This can be used in custom (Java-based) validation to return to the input page.

It can also be used to identify a "landing" page: an action base class or custom request processor might send GET requests to the input forward, and process POSTs normally.