在使用Eclipse或MyEclipse编辑XML文件的时候经常会碰到编辑器不提示的现象,这常常是因为其xml文件需要参考的DTD文件找不到,还有因为网络的问题不能及时提示而产生的。Eclipse/MyEclipse可以将本地的DTD文件添加至Eclipse中。以添加struts2的DTD文件为例,步骤如下:

  • window - preferences - xml catalog
  • add - location 选择 File System
  • Key Type 选择URI

Key 填入 http://struts.apache.org/dtds/struts-2.0.dtd (struts.xml文件根元素)

下图 为validation的例子

 MyEclipse 为xml添加本地的dtd文件

<!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.enable.DynamicMethodInvocation" value="false" />
    <constant name="struts.devMode" value="false" />

    <include file="example.xml"/>

    <!-- Add packages here -->

</struts>

相关文章:

  • 2021-10-01
  • 2021-09-05
  • 2022-12-23
  • 2021-07-11
  • 2022-01-25
  • 2021-06-25
  • 2021-04-29
猜你喜欢
  • 2021-09-12
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2021-06-28
  • 2021-09-16
相关资源
相似解决方案