Explain the struts-configuration file ?
- The struts-config.xml configuration file is a link between the View and Model components in the Web Client.
- It plays an important role in building both Controller components and Application-specific configurations.
- In Web NMS, this file is created specific to every application in the format as <module>-struts-config.xml.
The configuration file basically contains three main elements :
- <form-beans>
- <global-forwards>
- <action-mappings>
The Struts-config.xml File
The elements of the <module>-struts-config.xml file and their usage are described for an example module such as “fault”.
struts-config
- Is the root node of the configuration file.
form-beans
- The Form beans create ActionForm instances at runtime.
- The details of each form bean are provided in the <form-bean> element.
- The <form-property> elements within the form bean contain the property names and the property types of the form bean.
global forwards
- This section maps a page on your webapp to a name.
- You can use this name to refer to the actual page.
- This avoids hardcoding URLs on your web pages.
action-mappings
- Each action mapping is defined in an <action> element.
- The <forward> definition within <action>, maps the result of the action to the jsp page invoked.
- This is a ‘local’ forward and is optional. That is, for the particular request object, if there is no forward defined in the global forwards, it is specified in the <action-mapping> element.
controller
- The <controller> enables to configure the ActionServlet.
- The <controller> element defines the <action> elements in Fault to be local or global ActionForward names.
plug-in
- The <plug-in> element is used to include plug-ins in struts.
- The Web Client uses the Tiles plug-in and the Struts Validator plug-in