Structs复习 包含外部xml和默认Actiion

包含外部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" />
</struts>

放在同级目录下即可

defaulAction

Struct.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" />
    
    <package name="default" namespace="/" extends="struts-default">
        <default-action-ref name="index"></default-action-ref>
        <action name="index">
            <result>/default.jsp</result>
        </action>
    </package>
</struts>

他如果找不到命名空间下的Action就访问默认的action

 

posted @ 2018-08-13 14:20  橘柑之味  阅读(134)  评论(0编辑  收藏  举报