well actually
well actually

Reputation: 12370

struts-config.xml file - purpose of input

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>

Upvotes: 7

Views: 11237

Answers (1)

Dave Newton
Dave Newton

Reputation: 160181

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.

Upvotes: 8

Related Questions