zoukankan      html  css  js  c++  java
  • 如何为应用指定多个struts配置文件

    如何为应用指定多个struts配置文件
    在大部分应用里,随着应用规模的增加,
    系统中Action的数量也会大量增加,导致struts.xml配置文件变得非常臃肿,
    为了避免struts.xml文件过于庞大、臃肿,提高Struts.xml文件的可读性,
    我们可以将一个struts.xml配置文件分解成多个配置文件,
    然后再struts.xml文件中包含其他配置文件。

    通过<include>元素指定多个配置文件
    <struts>
      <include file="department.xml"/> 一个模块使用一个配置文件
      <include file="employee.xml"/>
    </struts>

    --------------------------------------------------------------------------------------------------------

    动态方法调用
    使用通配符定义Action即*
    <package name="employee" namespace="/control/employee" extends="struts-default">
          <action name="list_*" class="cn.itcast.action.HelloWorldAction" method="{1}">
                <result name="success">/WEB-INF/page/message.jsp</result>
          </action>
    </package>
    通过通配符动态调用方法

  • 相关阅读:
    collections工具类 排序
    API text|lang
    异常处理
    extends继承
    接口
    static修饰符
    多态与find关键词
    Markdown语法
    Hexo | (五)Yilia主题优化
    Hexo | (四)多机同步更新博客
  • 原文地址:https://www.cnblogs.com/wuhuisheng/p/2097795.html
Copyright © 2011-2022 走看看