五、指定多个配置文件

四、指定多个配置文件

    1.src目录下新建hello.xml

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

    <package name="default" namespace="/" extends="struts-default">
    
        <action name="helloworld_*" method="{1}" class="com.myz.action.HelloWorldAction">
            <result>/result.jsp</result>
            <result name="{1}">/{1}.jsp</result>
        </action>

    </package>
    
</struts>    

    2.struts.xml中引入

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
    <!-- 引入包下的xml
        <include file="com/myz/action/hello.xml"></include> 
        路径错误不会报错,会相当于没有引入
    -->
    <include file="hello.xml"></include>
</struts>    

 

posted @ 2018-02-19 19:56  菜鸡蔡文姬  阅读(145)  评论(0编辑  收藏  举报