struts2的約束配置

      使用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.接下來我們就可以再去試試。

發佈了46 篇原創文章 · 獲贊 3 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章