<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>

	<constant name="struts.devMode" value="true" />

	<package name="basicstruts2" extends="struts-default">
	
	<!-- setup the default-stack exception mapping interceptor 
 		so that any exceptions not caught by this application 
 		will be logged and then handled by the global exception 
 		mapping -->
 		<interceptors>
 		<interceptor-stack name="appDefault">
        	 <interceptor-ref name="defaultStack">
      			<param name="exception.logEnabled">true</param>
      			<param name="exception.logLevel">ERROR</param>
   			</interceptor-ref>
 	    </interceptor-stack>
		</interceptors>
		
		<default-interceptor-ref name="appDefault" />
		
        <global-results>
  		  <result name="error">/error.jsp</result>
  		  <result name="securityerror">/securityerror.jsp</result>
  	    </global-results>
  		

	    <global-exception-mappings>
	        <exception-mapping exception="org.apache.struts.register.exceptions.SecurityBreachException" result="securityerror" />
	        <exception-mapping exception="java.lang.Exception" result="error" />
	   	</global-exception-mappings>
	  
	    
         
        <action name="causesecurityexception" class="org.apache.struts.register.action.Register" method="throwSecurityException">
        	<result>/register.jsp</result>
        </action>
        
        <action name="causeexception" class="org.apache.struts.register.action.Register" method="throwException">
        	<result>/register.jsp</result>
        </action>
        
        <action name="causenullpointerexception" class="org.apache.struts.register.action.Register" method="throwNullPointerException">
        	<result>/register.jsp</result>
        </action>
        
        <action name="actionspecificexception" class="org.apache.struts.register.action.Register" method="throwSecurityException">
        	<exception-mapping exception="org.apache.struts.register.exceptions.SecurityBreachException" 
        	   result="login" />
        	<result>/register.jsp</result>
        	<result name="login">/login.jsp</result>
        </action>

        <!-- If no class attribute is specified the framework will assume success and 
        render the result index.jsp -->
        <!-- If no name value for the result node is specified the success value is the default -->
		<action name="index">
			<result>/index.jsp</result>
		</action>
		
		<!-- If the URL is hello.action the call the execute method of class HelloWorldAction.
		If the result returned by the execute method is success render the HelloWorld.jsp -->
		<action name="hello" class="org.apache.struts.helloworld.action.HelloWorldAction" method="execute">
			<result name="success">/HelloWorld.jsp</result>
		</action>
		
  <action name="register" class="org.apache.struts.register.action.Register" method="execute">
	<result name="success">/thankyou.jsp</result>
  </action>

	</package>

</struts>