File: /WEB-INF/validator/struts-config-i18nVariables.xml


        <?xml version="1.0" encoding="iso-8859-1"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You 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.
-->
<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
          "http://struts.apache.org/dtds/struts-config_1_3.dtd">

<struts-config>

  <!--============================================== Form Bean Definitions  -->
  <form-beans>

    <form-bean name="i18nForm" type="org.apache.struts.validator.DynaValidatorForm">
      <form-property name="name"     type="java.lang.String" />
      <form-property name="address1" type="java.lang.String" />
      <form-property name="address2" type="java.lang.String" />
      <form-property name="city"     type="java.lang.String" />
      <form-property name="state"    type="java.lang.String" />
      <form-property name="zip"      type="java.lang.String" />
      <form-property name="phone"    type="java.lang.String" />
      <form-property name="dob"      type="java.lang.String" />
      <form-property name="age"      type="java.lang.String" />
      <form-property name="doe"      type="java.lang.String" />
      <form-property name="emplno"   type="java.lang.String" />
      <form-property name="salary"   type="java.lang.String" />
      <form-property name="hours"    type="java.lang.String" />
    </form-bean>

  </form-beans>

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

    <!-- i18n Example Actions -->
    <action path="/viewI18nExample" forward="/i18nExample.jsp" />

    <action path="/validateI18nExample" 
            type="org.apache.struts.actions.ForwardAction" 
            name="i18nForm" 
            scope="request" 
            parameter="/welcome.do" 
            validate="true"
            cancellable="true"
            input="input" >
        <forward name="input" path="/viewI18nExample.do" />
    </action>

    <!-- JavaScript i18n Example Actions -->
    <action path="/viewJsI18nExample" forward="/i18nExampleJS.jsp" />
    <action path="/validateJsI18nExample" 
            type="org.apache.struts.actions.ForwardAction" 
            name="i18nForm" 
            scope="request" 
            parameter="/welcome.do" 
            validate="true"
            cancellable="true"
            input="input" >
        <forward name="input" path="/viewJsI18nExample.do" />
    </action>

    <!-- i18n Example - switch locale -->
    <action path="/switchI18nExample" 
            type="org.apache.struts.webapp.validator.LocaleAction" 
            name="localeForm" 
            scope="request">
        <forward name="success" path="/viewI18nExample.do" />
    </action>

    <!-- JavaScript i18n Example - switch locale -->
    <action path="/switchJsI18nExample" 
            type="org.apache.struts.webapp.validator.LocaleAction" 
            name="localeForm" 
            scope="request">
        <forward name="success" path="/viewJsI18nExample.do" />
    </action>


    <!-- Show struts-config.xml -->
    <action path="/showStrutsConfigI18nExample" 
            type="org.apache.struts.webapp.validator.ShowFileAction" 
            scope="request" 
            parameter="/WEB-INF/validator/struts-config-i18nVariables.xml">
        <forward name="success" path="/showFile.jsp" />
    </action>

    <!-- Show validations.xml -->
    <action path="/showValidationI18nExample" 
            type="org.apache.struts.webapp.validator.ShowFileAction" 
            scope="request" 
            parameter="/WEB-INF/validator/validation-i18nVariables.xml">
        <forward name="success" path="/showFile.jsp" />
    </action>

  </action-mappings>

  <!--============================================== Message Resources -->
  <!-- 
       The i18nExample Page uses the following message resources. 

       Localized validation variables have been separated out from the general text for 
       the page into the "i18nVariables" bundle. There are two reasons for doing this:
         1) The main reason is to have the bundle for the variables configured
            to return "null" if not found. If you debugging missing resource keys
            will be a pain.
         2) To have the bundle for the variables configured so that Struts doesn't
            automatically 'escape' single quotes.

    -->
  <message-resources key="i18nExample"   null="false" parameter="org.apache.struts.webapp.validator.I18nExample">
      <set-property key="mode" value="JSTL"/>
  </message-resources>
  <message-resources key="i18nVariables" null="true"  parameter="org.apache.struts.webapp.validator.I18nExampleVariables" >
      <set-property property="escape" value="false"/>
      <set-property key="mode" value="JSTL"/>
  </message-resources>

</struts-config>