Struts-Config.xml
 

The tie that binds!  Struts-config.xml provides late binding to tie the various parts of a Struts application together. 


The example below is intended to show the basic parts of a struts-config.xml file and its basic syntax; tags that repeat similar constructs have been deleted.



Example


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">

<struts-config>

  <data-sources>
  </data-sources>
  
  <form-beans>
    <form-bean name="formBeanUser" type="jbs.eb2c.formbean.FormBeanUser"/>
    <form-bean name="formBeanCategory" type="jbs.eb2c.formbean.FormBeanCategory"/>
    <form-bean name="formBeanProduct" type="jbs.eb2c.formbean.FormBeanProduct"/>
    <form-bean name="formBeanCheckout" type="jbs.eb2c.formbean.FormBeanCheckout"/>
  </form-beans>
  
  <global-exceptions>
  </global-exceptions>
  
  <global-forwards>
  </global-forwards>
  
  <action-mappings>
  
    <action path="/actionUserRegister" name="formBeanUser" 
    	type="jbs.eb2c.action.ActionUser" scope="request" input="/view/struts/register.jsp">
      <forward name="successRegister" path="/view/struts/framesetHome.jsp"/>
      <forward name="failureRegister" path="/view/struts/register.jsp"/>
      <forward name="error" path="/view/struts/error.jsp"/>
    </action>
    
    <action path="/actionUserLogin" name="formBeanUser" 
    	type="jbs.eb2c.action.ActionUser" scope="request" input="/view/struts/login.jsp">
      <forward name="successLogin" path="/view/struts/framesetHome.jsp"/>
      <forward name="failureLogin" path="/view/struts/login.jsp"/>
      <forward name="error" path="/view/struts/error.jsp"/>
    </action>
    
    <action path="/actionUserUpdate" name="formBeanUser" 
    	type="jbs.eb2c.action.ActionUser" scope="request" input="/view/struts/userUpdate.jsp">
      <forward name="successUpdate" path="/view/struts/userUpdate.jsp"/>
      <forward name="failureUpdate" path="/view/struts/userUpdate.jsp"/>
      <forward name="successLoad" path="/view/struts/userUpdate.jsp"/>
      <forward name="failureLoad" path="/view/struts/userUpdate.jsp"/>
      <forward name="error" path="/view/struts/error.jsp"/>
    </action>
    
    <action path="/actionUser" name="formBeanUser" 
    	type="jbs.eb2c.action.ActionUser" scope="request" >
      <forward name="successLogout" path="/view/struts/logout.jsp"/>
      <forward name="error" path="/view/struts/error.jsp"/>
    </action>
    
    <action path="/actionUserAdmin" name="formBeanUser" 
    	type="jbs.eb2c.action.ActionUserAdmin" scope="request" input="/view/struts/userAdmin.jsp">
      <forward name="success" path="/view/struts/userAdmin.jsp"/>
      <forward name="failure" path="/view/struts/userAdmin.jsp"/>
      <forward name="error" path="/view/struts/error.jsp"/>
    </action>

  </action-mappings>
  
  <controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
  <message-resources parameter="jbs.eb2c.resources.MessageResources"/>

</struts-config>