71. What we will define in struts-config.xml file.

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

<data-sources>
      <data-source    autoCommit=”false”
                              description=”Second Database Config”
                              driverClass=”oracle.jdbc.driver.OracleDriver”
                               key=”REFDB”
                               maxCount=”4″ 
                               minCount=”2″
                               password=”admin”
                               url=”jdbc:oracle:thin:@localhost:1521/AUTHORDB”
                               user=”admin”
        />
</data-sources>

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

<form-beans>
         <form-bean name=”searchForm”>
                            type=”com.abc.struts.SearchForm”
        </form-bean>
</form-beans>

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

<global-forwards>
          <forward name=”search” path=”/search.jsp” />
</global-forwards>

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

<action-mapping>
         <action path=”/search”
                     type=”com.abc.struts.SearchAction”
                     name=”searchForm”
                     scope=”request”
                     validate=”true”
                     input=”/search.jsp”>
          <forward name=”results” path=”/results.jsp” />
         </action>
</action-mapping>

Advertisements

4 Responses

  1. 1.Global Forwards:

    2.FormBeans

    3.ActionMappings

    4.MessageResources

    5.Validator Plugins

  2. Request processor is : org.apache.struts.action.RequestProcessor in struts. Get more detail about it from the struts documentation.

  3. There are cases when you want to replace or extend RequestProcessor to have your own specialized processor. For instance, when using Tiles (a JSP page template framework) in conjunction with Struts, you would use TilesRequestProcessor.

  4. i hava seen a forward element inside an action element of action mapping with the path of forward element not refering to a jsp page of anyother action!! it ends with some thing like this “.index” . and the context relative attiribute of forward is also set to false!! what does it mean???

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: