Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
like image 432
well actually Avatar asked Dec 10 '11 00:12

well actually


People also ask

What is the use of struts-config XML file?

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.

What is the use of input attribute in action tag in struts?

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.

What is parameter in struts-config xml?

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.

What are different configuration files required in struts?

The struts application contains two main configuration files struts. xml file and struts. properties file. The struts.


1 Answers

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.

like image 61
Dave Newton Avatar answered Oct 31 '22 12:10

Dave Newton