<?xml version="1.0" encoding="ISO-8859-1" ?>

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


<!--

 Copyright 2002,2004 The Apache Software Foundation.
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
      http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.

-->


<!--
     This is the Struts configuration file for the example application,
     using the proposed new syntax.

     NOTE:  You would only flesh out the details in the "form-bean"
     declarations if you had a generator tool that used them to create
     the corresponding Java classes for you.  Otherwise, you would
     need only the "form-bean" element itself, with the corresponding
     "name" and "type" attributes.
-->


<struts-config>


  <!-- ========== Data Source Configuration =============================== -->
<!--
 <data-sources>
   <data-source>
     <set-property property="autoCommit"
                      value="false"/>
     <set-property property="description"
                      value="Example Data Source Configuration"/>
     <set-property property="driverClass"
                      value="org.postgresql.Driver"/>
     <set-property property="maxCount"
                      value="4"/>
     <set-property property="minCount"
                      value="2"/>
     <set-property property="password"
                      value="mypassword"/>
     <set-property property="url"
                      value="jdbc:postgresql://localhost/mydatabase"/>
     <set-property property="user"
                      value="myusername"/>
   </data-source>
 </data-sources>
-->
  <!-- ========== Form Bean Definitions =================================== -->
  <form-beans>

    <!-- Logon form bean -->
    <form-bean      name="logonForm"
                    type="org.apache.struts.validator.DynaValidatorForm">
      <form-property name="username" type="java.lang.String"/>
      <form-property name="password" type="java.lang.String"/>
    </form-bean>

    <!-- Registration form bean -->
    <form-bean      name="registrationForm"
                    type="org.apache.struts.webapp.example2.RegistrationForm"/>

    <!-- Subscription form bean -->
    <form-bean      name="subscriptionForm"
                    type="org.apache.struts.webapp.example2.SubscriptionForm"/>

  </form-beans>


  <!-- ========== Global Forward Definitions ============================== -->
  <global-forwards>
    <forward   name="logoff"               path=".welcome"/>
    <forward   name="logon"                path=".logon"/>
    <forward   name="registration"         path=".registration"/>
    <forward   name="subscription"         path=".subscription"/>
    <forward   name="success"              path=".mainMenu"/>
    <forward   name="failure"              path=".welcome"/>
  </global-forwards>


  <!-- ========== Action Mapping Definitions ============================== -->
  <action-mappings>

    <!-- Display logon page -->
    <action    path="/editLogon"
            forward=".logon"/>

    <!-- Edit user registration -->
    <action    path="/editRegistration"
               type="org.apache.struts.webapp.example2.EditRegistrationAction"
          attribute="registrationForm"
              scope="request"
           validate="false">
      <forward name="register"             path=".register"/>
      <forward name="success"              path=".registration"/>
    </action>

    <!-- Edit mail subscription -->
    <action    path="/editSubscription"
               type="org.apache.struts.webapp.example2.EditSubscriptionAction"
          attribute="subscriptionForm"
              scope="request"
           validate="false">
      <forward name="failure"              path=".mainMenu"/>
      <forward name="success"              path=".subscription"/>
    </action>

    <!-- Process a user logoff -->
    <action    path="/logoff"
               type="org.apache.struts.webapp.example2.LogoffAction">
      <forward name="success"              path=".welcome"/>
    </action>

    <!-- Process a user logon -->
    <action    path="/logon"
               type="org.apache.struts.webapp.example2.LogonAction"
               name="logonForm"
              scope="request"
              input="logon">
      <exception
                key="expired.password"
               type="org.apache.struts.webapp.example2.ExpiredPasswordException"
               path="/changePassword.faces"/>
    </action>

    <!-- Save user registration -->
    <action    path="/saveRegistration"
               type="org.apache.struts.webapp.example2.SaveRegistrationAction"
               name="registrationForm"
              scope="request"
              input="registration"/>

    <!-- Save mail subscription -->
    <action    path="/saveSubscription"
               type="org.apache.struts.webapp.example2.SaveSubscriptionAction"
               name="subscriptionForm"
              scope="request"
              input="subscription">
      <forward name="success"         path="/editRegistration.do?action=Edit"/>
    </action>

    <!-- Display the "walking tour" documentation -->
    <action    path="/tour"
            forward="/tour.htm">
    </action>

    <!-- Display welcome page -->
    <action    path="/welcome"
            forward=".welcome"/>

  </action-mappings>


  <!-- ========== Controller Configuration ================================ -->

  <controller>
    <!-- The "input" parameter on "action" elements is the name of a
         local or global "forward" rather than a subapp-relative path -->
    <set-property property="inputForward" value="true"/>
    <set-property property="processorClass"
            value="org.apache.struts.faces.application.FacesTilesRequestProcessor"/>
  </controller>


  <!-- ========== Message Resources Definitions =========================== -->

  <message-resources
    parameter="org.apache.struts.webapp.example2.ApplicationResources"/>


  <!-- ========== Plug Ins Configuration ================================== -->

  <plug-in className="org.apache.struts.tiles.TilesPlugin">
    <set-property property="definitions-config"
                     value="/WEB-INF/tiles-defs.xml"/>
  </plug-in>

  <plug-in className="org.apache.struts.webapp.example2.memory.MemoryDatabasePlugIn">
    <set-property property="pathname" value="/WEB-INF/database.xml"/>
  </plug-in>

  <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property property="pathnames"
                     value="/WEB-INF/validator-rules.xml,
                            /WEB-INF/validation.xml"/>
  </plug-in>

</struts-config>
