struct部分配置

<?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>
<!-- *******************************************************
要特别注意顺序问题1:拦截器要放在最上面
2:全局视图要在action前面
3:引用自定义拦截器名注意空格 -->
<package name="department" namespace="/control/department" extends="struts-default">

<interceptors>
<interceptor name="permission" class="com.itany.convertor.PermissionInterceptor" />
<interceptor-stack name="permissionStack">
<!-- 要继承默认拦截器 -->
<interceptor-ref name="defaultStack" />
<!-- 加载自己的拦截器 -->
<interceptor-ref name="permission" />
</interceptor-stack>
</interceptors>

<!-- 全局视图 -->
<global-results>
<result>/WEB-INF/page/msg.jsp</result>
</global-results>
<!-- 自定义拦截器 -->
<action name="helloWorld3" class="com.itany.action.HelloWorldAction1" >
<!-- 为该方法启用拦截器 -->
<interceptor-ref name="permissionStack"/>
</action>

<!-- 调用某个某个方法,默认调用ActionSupport中的execute方法 -->
<action name="helloWorld_*" class="com.itany.action.HelloWorldAction" method="{1}" >
<result>/WEB-INF/page/hello.jsp</result>
<result name="add">/WEB-INF/page/hello.jsp</result>
</action>

<!-- 接受请求参数 -->
<!-- 基本数据类型 -->
<action name="list1_*" class="com.itany.action.HelloWorldAction4" method="{1}" >
<result>/WEB-INF/page/hello.jsp</result>
<result name="add">/WEB-INF/page/hello.jsp</result>
</action>
<!-- 复合数据类型 -->
<action name="list2_*" class="com.itany.action.HelloWorldAction5" method="{1}" >
<result>/WEB-INF/page/hello1.jsp</result>
<result name="add">/WEB-INF/page/hello1.jsp</result>
</action>
<!-- 类型转换器 -->
<action name="list3_*" class="com.itany.action.HelloWorldAction5" method="{1}" >
<result>/WEB-INF/page/hello1.jsp</result>
<result name="add">/WEB-INF/page/hello1.jsp</result>
</action>

<!-- 访问或者添加request/session/application属性 -->
<action name="list4_*" class="com.itany.action.HelloWorldAction6" method="{1}" >
<result>/WEB-INF/page/test1.jsp</result>
<result name="add">/WEB-INF/page/hello1.jsp</result>
</action>
<!-- 单文件上传-->
<action name="list5_*" class="com.itany.action.HelloWorldAction7" method="{1}" >
<result>/WEB-INF/page/testFile.jsp</result>
<result name="add">/WEB-INF/page/hello1.jsp</result>
</action>
<!-- 多文件上传-->
<action name="list6_*" class="com.itany.action.HelloWorldAction8" method="{1}" >
<result>/WEB-INF/page/testFile.jsp</result>
<result name="add">/WEB-INF/page/hello1.jsp</result>
</action>
</package>

<!-- 接受json型数据 -->
<package name="department_json" namespace="/control/department_json" extends="json-default">
<action name="jsontest_*" class="com.itany.action.HelloWorldAction9" method="{1}" >
<result name="message" type="json"></result>
<result name="userInfo" type="json"></result>
<result name="list" type="json"></result>
</action>
</package>
</struts>

posted @ 2015-05-14 20:26  爱上咖啡的唐  阅读(118)  评论(0编辑  收藏  举报