struts2的约束配置

xiaoxiao2021-02-27  392

      使用Eclipse或MyEclipse编辑XML文件的时候经常会碰到编辑器不提示的现象,这常常是因为其xml文件需要参考的DTD文件找不到,还有因为网络的问题不能及时提示而产生的。

Eclipse/MyEclipse可以将本地的DTD文件添加至Eclipse中。以添加struts2的DTD文件为例:

1.window - preferences - xml catalog

        2.add - location 选择 File System(自行下载struts2的dtd文件)

       3.Key Type 选择URI

       4.Key 填入 http://struts.apache.org/dtds/struts-2.3.dtd(这里面的2.3表示的是struts2的2.3的版本)

       5.在struts.xml中添加

<struts>

    <constant name="struts.enable.DynamicMethodInvocation" value="false" />     <constant name="struts.devMode" value="false" />

    <include file="example.xml"/>

    <!-- Add packages here -->

</struts>

      6.接下来我们就可以再去试试。

转载请注明原文地址: https://www.6miu.com/read-2959.html

最新回复(0)