首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Struts2应用开发详解-九、指定多个配置文件

2012-09-09 
Struts2应用开发详解--9、指定多个配置文件复杂的系统开发会有很多的action配置。为便于管理开发中应该按照

Struts2应用开发详解--9、指定多个配置文件

复杂的系统开发会有很多的action配置。为便于管理开发中应该按照功能模块或者业务分类,将sturts配置文件分成不同的文件,便于管理、维护。最后将这些文件在struts.xml中进行包含声明。

?

student.xml

<struts>?
??? <package name="student" namespace="/student" extends="struts-default">

??????? <action name="helloworld" namespace="/class" extends="struts-default">

??????? <action name="helloworld" value="do,action"></constant>
?? <constant name="struts.configuration.xml.reload" value="true"></constant>
?

?? <include file="student.xml" />

?? <include file="class.xml" />

</struts>

?如上配置所示,sturts.xml中引入了student.xml、class.xml的定义。也对属性参数进行了定义。面向对象的封装思维这里有了体现,封装便于管理、引用。全局参数则在全局的文件总进行设置。

热点排行