Struts.xml文件包含(7)

文件包含:这种方式适用于分模块开发

struts.xml文件包含login.xml

<?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" />
    <include file="login.xml" /><!--包含login.xml文件-->
</struts>

 编写login.xml

<?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>
    <package name="login" extends="struts-default" namespace="/login">
        <action name="login*" class="com.bjsxt.struts2.user.action.LoginAction{1}">
            <result>/user_login_success.jsp</result>
        </action>
    </package>
</struts>

猜你喜欢

转载自weigang-gao.iteye.com/blog/2156379