www.pudn.com > struts2.rar > struts.xml, change:2009-08-21,size:4424b


<?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> 
 
	<!-- <include file="struts2_1.xml"></include> 
	<include file="struts2_2.xml"></include> --> 
	<constant name="struts.custom.i18n.resources" value="message"></constant> 
	 
	<!--  <constant name="struts.i18n.encoding" value="gbk"></constant>--> 
	 
	 
	<!--  <package name="struts2" extends="struts-default" namespace="/manager">--> 
	<package name="struts2" extends="struts-default" > 
		 
		<interceptors> 
			<interceptor name="myInterceptor" class="com.test.interceptor.MyInterceptor"> 
				<param name="hello">world</param> 
			</interceptor> 
			<interceptor name="myInterceptor2" class="com.test.interceptor.MyInterceptor2"> 
			</interceptor> 
			<interceptor name="myInterceptor3" class="com.test.interceptor.MyInterceptor3"> 
			</interceptor> 
			<interceptor name="auth" class="com.test.interceptor.AuthInterceptor"> 
			</interceptor> 
			 
			<interceptor-stack name="myStack"> 
				<interceptor-ref name="myInterceptor"></interceptor-ref> 
				<interceptor-ref name="myInterceptor2"></interceptor-ref> 
				<interceptor-ref name="myInterceptor3"></interceptor-ref> 
				<interceptor-ref name="defaultStack"></interceptor-ref> 
			</interceptor-stack> 
		</interceptors> 
		 
		<default-interceptor-ref name="myStack"></default-interceptor-ref> 
		 
		<global-results> 
			<result name = "result">/login2.jsp</result> 
		</global-results> 
		 
		<!-- <action name="*login" class="com.test.action.LoginAction" method="{1}">--><!-- 通配符:*表示要访问的方法名,在jsp的form中配置 <s:form action="denglulogin"...那么就会访问此action。 method="{1}"表示取第一个*的内容即denglu,并在action中调用名为denglu的方法--> 
		<action name="login" class="com.test.action.LoginAction"> 
			<result name="input">/login2.jsp</result> 
			<result name="success">/result.jsp</result> 
			 
			<!--  <result name="success">/register.jsp</result>--> 
			<result name="failer">/login2.jsp</result> 
			 
			<interceptor-ref name="defaultStack"></interceptor-ref> 
		</action> 
		 
		<action name="pointConverter" class="com.test.action.PointAction"> 
			<result name="success">/output.jsp</result> 
			<result name="input">/input.jsp</result> 
		</action> 
		 
		<!-- <action name="register" class="com.test.action.RegisterAction2" method="test"> --> 
		<action name="register" class="com.test.action.RegisterAction"> 
			<result name="success">/success.jsp</result> 
			<result name="input">/register.jsp</result> 
			<result name="login">/login2.jsp</result> 
			<result name="invalid.token">/register.jsp</result> 
			<interceptor-ref name="token"></interceptor-ref> 
			<!-- 重新定义了默认拦截器后就不必再次引用了--> 
			<interceptor-ref name="myInterceptor"> 
				<param name="hello">welcome</param> 
			</interceptor-ref> 
			<interceptor-ref name="myInterceptor3"> 
				<param name="excludeMethods">execute</param><!--不对execute方法使用此拦截器 --> 
				<param name="includeMethods">test,execute</param><!--对test方法使用此拦截器 --> 
			</interceptor-ref> 
			<interceptor-ref name="auth"></interceptor-ref> 
			<interceptor-ref name="defaultStack"></interceptor-ref> 
		</action> 
 
	</package> 
	 
	<package name="ajax1" extends="json-default" > 
		<action name="JsonPlugin" class="com.ajax.action.JsonPluginAction"> 
            <result type="json" /> 
        </action>       
         
        <action name="Autocompleter" class="com.ajax.action.AutocompleterAction"> 
   			 <result type="json"> 
        		<param name="root">names</param> 
        		<!-- 在JSON类型结果的参数中加入“root”参数可以设定输出JSON结果的根,以上述情况为例,如果没有“root”参数,输出将为“{ "names": [ ["xxx", "xxx"]...] }”,加了之后变就会成“[ ["xxx", "xxx"]...] ”。 --> 
    		</result> 
		</action>  
		 
		<action name="DynamicTree" class="com.ajax.action.DynamicTreeAction"> 
            <result>tree2.jsp</result> 
        </action> 
         
         <action name="AjaxTree" class="com.ajax.action.AjaxTreeAction"> 
            <result>tree3.jsp</result> 
            <result name="ajax" type="freemarker">AjaxTree.ftl</result> 
        </action> 
	 
	 
	</package> 
 
</struts>