11.包含模块配置文件
struts.xml文件中可包含多个struts.xml文件
<struts>
<include file="struts-1.xml"></include>
</struts>
12.默认action(default action)
效果:访问http://localhost:8080/hello/相当于访问http://localhost:8080/hello/index.action,即找不到或省略namespce后面的action时,使用默认配置的action
注意:当访问http://localhost:8080/hello/,默认action配置可能不生效,因为在web.xml中可能默认加载index.jsp,若想是默认action配置生效,可改变web.xml中文件的名称
<struts>
<constant name="struts.devMode" value="true" />
<package name="default" extends="struts-default" namespace="/">
<default-action-ref name="index"></default-action-ref>
<action name="index" >
<result>/default.jsp</result>
</action>
</package>
</struts>
本文介绍了Struts框架中struts.xml文件如何通过包含其他配置文件进行模块化管理,并详细解释了默认action配置的作用及实现方法。
&spm=1001.2101.3001.5002&articleId=70234083&d=1&t=3&u=b00776253f9a43b8890aa27060198115)
164

被折叠的 条评论
为什么被折叠?



