What we will define in Struts-config.xml file. And explain their purpose

Showing Answers 1 - 8 of 8 Answers


  • Mar 8th, 2005

The main control file in the Struts framework is the struts-config.xml XML file, where action mappings are specified. This file's structure is described by the struts-config DTD file, which is defined at http://jakarta.apache.org/struts/. A copy of the DTD can be found on the /docs/dtds subdirectory of the framework's installation root directory. The top-level element is struts-config. Basically, it consists of the following elements:

data-sources—A set of data-source elements, describing parameters needed to instantiate JDBC 2.0 Standard Extension DataSource objects

form-beans—A set of form-bean elements that describe the form beans that this application uses

global-forwards—A set of forward elements describing general available forward URIs

action-mappings—A set of action elements describing a request-to-action mapping

Suresh Pendyala

  • May 7th, 2005

It is heart of the Struts application.

  Was this answer useful?  Yes


  • Sep 20th, 2005

We will define formbean name ,exception types in struts-config.xml.Apart from this we will give action mapping which has actionpath,type,name,scope and forward name.

  Was this answer useful?  Yes

chirag desai

  • Oct 14th, 2005

We will define Data-source[for database connectivity],Action Mappings[for action input and next output],Action Forward[global forward],Action Errors etc....

  Was this answer useful?  Yes

Thiyagarajan Nagan

  • Apr 3rd, 2007

Struts-config.xml will have form-bean definitions and action-mappings definitions. After getting the request, the controller will look for mapping information in this xml file and lead to action class or whatever. Then the model(Action class) will process the request and return the Actionforward object back to the controller. Again the controller will look for mapping information in struts-config.xml and transfer the Actionforward object to the correct jsp page.

  Was this answer useful?  Yes

Sony V George

  • Apr 4th, 2007

We can say like soul of struts is Struts-config.xml.

The server will read struts-config.xml once only on the time of server starting. so server will know how and where to re-route to each and every request according to the flow. The Struts-config.xml have all the datsils like

Form-bean, Data-source, Action-Mapping, Applicationproperties, Global-exception,Global-error.

Server will have the context of all these details.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions