zoukankan      html  css  js  c++  java
  • struts框架的一些注意点

    1、Struts.xml文件中<include file="">标签的运用

      用法:此标签引用配置文件,Struts2提供了一个默认的struts.xml文件,当此配置文件中的package、action、interception等配置信息比较多的时候,都写在struts.xml文件中不好维护,那么需要将struts.xml文件分成多个配置文件,然后再使用<include>标签引用这些配置文件。

      好处:易于维护,看起来代码比较简单,清晰明了

      注意:用<include>引用的xml文件也必须是完成的struts2的配置。作用是“引用解析xml文件”,而不是将引用文件直接插入struts.xml文件中

    <struts>
    <!-- 引进框架核心组件 -->
    <include file="struts-efw.xml" />
    <package name="Yxwdgl_yxwdModule" namespace="/service" extends="ec-default">

    注意:struts.xml和struts-efw.xml中<package></package>标签中的name属性不能相同。道理很简单,<struts></struts>标签中可以有多个<package></package>标签,要通过name属性以示区别。

     

    延伸:

    2、<include>标签和<global-results>标签结合

      (1)<global-results>标签作用域只是当前<struts></struts>,(当前xml文件);而不允许把struts-efw.xml(通过<include>引入到struts.xml)中的<global-results>标签写在struts.xml中;

      (2)如果struts-efw.xml中的package继承自struts.xml中的package,则可以将struts-efw.xml中的<global-results>放在struts.xml中。然后struts-efw.xml将此<global-results>从struts.xml中继承过来。

    本人目前处于学习阶段,各位大神多多提宝贵的建议!
  • 相关阅读:
    python动态规划解决矩阵连乘
    ISCC2019-digdigdig
    MultiSelectComboBox(一)
    中国地图 xaml Canvas
    NotificationObject.cs
    DelegateCommand.cs
    SQL-PIVOT 数据透视 行列转换
    中国行政区域(省,市,县)SQL
    WCF自定义地址路由映射(不用svc文件)
    java下载安装,环境变量,hello world
  • 原文地址:https://www.cnblogs.com/FanSunny/p/4720463.html
Copyright © 2011-2022 走看看