<?xml version="1.0" encoding="UTF-8" ?>
<!--
/*
 * 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 PUBLIC
	"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
	"http://struts.apache.org/dtds/struts-2.5.dtd">
	
<struts>

    <constant name="struts.beanValidation.providerClass" value="org.hibernate.validator.HibernateValidator"/>
    <constant name="struts.beanValidation.ignoreXMLConfiguration" value="true"/>

    <package name="bean-validation" extends="struts-bean-validation" namespace="/bean-validation">
		<!-- Actions are configured via annotations -->
	</package>

	<package name="validation" extends="json-default" namespace="/validation">
        <action name="index">
            <result>index.jsp</result>
        </action>

	    <action name="quizBasic" class="org.apache.struts2.showcase.validation.QuizAction">
            <result name="input">/WEB-INF/validation/quiz-basic.jsp</result>
            <result>/WEB-INF/validation/quiz-success.jsp</result>
        </action>

        <action name="quizClient" class="org.apache.struts2.showcase.validation.QuizAction">
            <result name="input">/WEB-INF/validation/quiz-client.jsp</result>
            <result>/WEB-INF/validation/quiz-success.jsp</result>
        </action>

		<action name="quizDwr" class="org.apache.struts2.showcase.validation.QuizAction">
			<result name="input">/WEB-INF/validation/quiz-dwr.jsp</result>
			<result>/WEB-INF/validation/quiz-success.jsp</result>
		</action>

        <action name="quizClientCss" class="org.apache.struts2.showcase.validation.QuizAction">
            <result name="input">/WEB-INF/validation/quiz-client-css.jsp</result>
            <result>/WEB-INF/validation/quiz-success.jsp</result>
        </action>

        <action name="quizAjax" class="org.apache.struts2.showcase.validation.QuizAction">
            <interceptor-ref name="jsonValidationWorkflowStack"/>
            <result name="input">/WEB-INF/validation/quiz-ajax.jsp</result>
            <result>/WEB-INF/validation/quiz-success.jsp</result>
        </action>

		<!-- =========================================== -->
		<!-- === ajax form submit                    === -->
		<!-- =========================================== -->
		<action name="ajaxFormSubmit" class="org.apache.struts2.showcase.validation.AjaxFormSubmitAction">
			<interceptor-ref name="jsonValidationWorkflowStack" />
			<result name="input">/WEB-INF/validation/ajaxFormSubmit.jsp</result>
			<result type="jsonActionRedirect">ajaxFormSubmitSuccess</result>
		</action>
		<action name="ajaxFormSubmitSuccess" class="org.apache.struts2.showcase.validation.AjaxFormSubmitSuccessAction">
			<result>/WEB-INF/validation/ajaxFormSubmitSuccess.jsp</result>
		</action>
		
	</package>


	<package name="validationExamples" extends="struts-default" namespace="/validation" >

		<action name="list">
			<result>index.jsp</result>
		</action>
		
		
		<!-- ======================== -->
		<!-- === Field Validators === -->
		<!-- ======================== -->
		
		<action name="showFieldValidatorsExamples" class="org.apache.struts2.showcase.validation.FieldValidatorsExampleAction" method="input">
			<result name="input" type="dispatcher">/WEB-INF/validation/fieldValidatorsExample.jsp</result>
		</action>
		
		<action name="submitFieldValidatorsExamples" class="org.apache.struts2.showcase.validation.FieldValidatorsExampleAction" method="submit">
			<result name="input" type="dispatcher">/WEB-INF/validation/fieldValidatorsExample.jsp</result>
			<result type="dispatcher">/WEB-INF/validation/successFieldValidatorsExample.jsp</result>
		</action>
		
		
		
		<!-- ============================ -->
		<!-- === Non Field Validators === -->
		<!-- ============================ -->
		
		<action name="showNonFieldValidatorsExamples" class="org.apache.struts2.showcase.validation.NonFieldValidatorsExampleAction" method="input">
			<result name="input">/WEB-INF/validation/nonFieldValidatorsExample.jsp</result>
		</action>
		
		<action name="submitNonFieldValidatorsExamples" class="org.apache.struts2.showcase.validation.NonFieldValidatorsExampleAction" method="submit">
			<result name="input">/WEB-INF/validation/nonFieldValidatorsExample.jsp</result>
			<result>/WEB-INF/validation/successNonFieldValidatorsExample.jsp</result>
		</action>
		
		
		
		<!-- ========================== -->
		<!-- === Visitor Validators === -->
		<!-- ========================== -->
		
		<action name="showVisitorValidatorsExamples" class="org.apache.struts2.showcase.validation.VisitorValidatorsExampleAction" method="input">
			<result name="input">/WEB-INF/validation/visitorValidatorsExample.jsp</result>
		</action>
		
		<action name="submitVisitorValidatorsExamples" class="org.apache.struts2.showcase.validation.VisitorValidatorsExampleAction" method="submit">
			<result name="input">/WEB-INF/validation/visitorValidatorsExample.jsp</result>
			<result>/WEB-INF/validation/successVisitorValidatorsExample.jsp</result>
		</action>



		<!-- ========================== -->
		<!-- === Visitor Validators === -->
		<!-- ========================== -->

		<action name="clientSideValidationExample" class="org.apache.struts2.showcase.validation.FieldValidatorsExampleAction" method="input">
			<result name="input">/WEB-INF/validation/clientSideValidationExample.jsp</result>
		</action>

		<action name="submitClientSideValidationExample" class="org.apache.struts2.showcase.validation.FieldValidatorsExampleAction" method="submit">
			<result name="input">/WEB-INF/validation/clientSideValidationExample.jsp</result>
			<result>/WEB-INF/validation/successClientSideValidationExample.jsp</result>
		</action>

		<!-- =========================================== -->
		<!-- === Store Error Messages Across Request === -->
		<!-- =========================================== -->
		
		<action name="submitApplication" class="org.apache.struts2.showcase.validation.SubmitApplication" method="submitApplication">
			<interceptor-ref name="store">
				<param name="operationMode">STORE</param>
			</interceptor-ref>
			<interceptor-ref name="defaultStack" />
			<result name="input" type="redirect">/validation/resubmitApplication.action</result>
			<result type="redirect">/validation/applicationOk.action</result>
		</action>
		<action name="resubmitApplication" class="org.apache.struts2.showcase.validation.SubmitApplication">
			<interceptor-ref name="store">
				<param name="operationMode">RETRIEVE</param>
			</interceptor-ref>
			<result>/WEB-INF/validation/storeErrorsAcrossRequestExample.jsp</result>
		</action>
		<action name="storeErrorsAcrossRequestExample">
			<result>/WEB-INF/validation/storeErrorsAcrossRequestExample.jsp</result>
		</action>
		<action name="applicationOk" class="org.apache.struts2.showcase.validation.SubmitApplication" method="applicationOk">
			<interceptor-ref name="store">
				<param name="operationMode">RETRIEVE</param>
			</interceptor-ref>
			<result>/WEB-INF/validation/storeErrorsAcrossRequestOk.jsp</result>
		</action>
		<action name="cancelApplication" class="org.apache.struts2.showcase.validation.SubmitApplication" method="cancelApplication">
			<result>/WEB-INF/validation/storeErrorsAcrossRequestCancel.jsp</result>
		</action>
		
    </package>
</struts>
	
