Struts2配置文件

src 目录下的 struts.xml

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

<struts>

	<constant name="struts.i18n.encoding" value="UTF-8"></constant>

    <package name="" namespace="/" extends="struts-default">
    	<!-- 定义拦截器 -->
    	<interceptors>
    		<interceptor name="myinterceptor" class="com.aowin.interceptor.MyInterceptor"></interceptor>
    	</interceptors>
    	<action name="login" method="execute" class="com.aowin.action.LoginAction2">
    		<interceptor-ref name="myinterceptor"></interceptor-ref>
    		<interceptor-ref name="params"></interceptor-ref>
    		<exception-mapping result="error" exception="java.lang.ArithmeticException"></exception-mapping>
    		<result name="success" type="redirect">/welcome.jsp</result>
    		<result name="error" >/error.jsp</result>
    	</action>
    	<action name="pomain" class="com.aowin.action.PomainAction">
    		<result name="success">/welcome.jsp</result>
    	</action>
    	<!-- 下面配置形式 method 必加 -->
    	<action name="pomain_*" method="{1}" class="com.aowin.action.PomainAction">
    		<result name="success">/welcome.jsp</result>
    	</action>
    	<action name="somain" class="com.aowin.action.Somain1Action">
    		<result name="success">/welcome.jsp</result>
    	</action>
    </package>
    <package name="sale" namespace="/sale" extends="struts-default">
    	<action name="somain" class="com.aowin.action.Somain2Action">
    		<result name="success">/welcome.jsp</result>
    	</action>
    </package>

</struts>
 

你可能感兴趣的:(struts2)