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>
The controller servlet uses a struts-config. xml file to map incoming requests to Struts Action objects, and instantiate any ActionForm objects associated with the action to temporarily store form data. The Action object processes requests using its execute method, while making use of any data stored in the form bean.
Struts will forward the user to the page/action specified in the input attribute if validation fails on the form specified in the name attribute.
In Struts1 you can use the attribute parameter from element(struts-config. xml) and access it's value within the action class via the actionMapping. getParameter() method. For actions requiring multiple steps, the parameter is often used to indicate which step the mapping is associated with.
The struts application contains two main configuration files struts. xml file and struts. properties file. The struts.
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 POST
s normally.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With