struts2-9为应用指定多个配置文件

为应用指定多个struts配置文件:
在大部分应用里,顺着规模的增加,系统中action的数量也会大量增加,导致struts.xml配置文件变得非常臃肿。为了避免struts.xml文件过于庞大、臃肿,提高struts文件的可读性,我们将struts配置文件分解为多个配置文件,然后在struts.xml文件中包含其他配置文件,下面的struts.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.action.extension" value="do,action"/>
    <include file="department.xml"/>
    <include file="employee.xml"/>
</struts>

通过该方式就可以将struts2的action按模块添加到多个配置文件中。

猜你喜欢

转载自blog.csdn.net/weixin_39660593/article/details/78781957