如果在eclipse中配置只需要,只需要在菜單欄window->preference->Myeclipse->file and eiditor->xml->xml catalog->add添加:
Location中選中struts-2.3.dtd所在位置如下圖所示
Key Type選中URI
Key:在struts.xml中有 <!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd"> 選中http://struts.apache.org/dtds/struts-2.3.dtd即可
在eclispe中如上配置以後 保存,編寫struts.xml文件時就可自動出現提示了。但是MyEclipse中還要如下改一下編輯器
因爲對於MyEclipse來說 它的默認設置裏沒有設置XML編輯器,而是設置成了MyEclipse struts2的xml編輯器,所以我們要將xml文件所對應的編輯器設置爲
MyEclipse
XML編輯器。
General----->File Association----> File types選擇*.xml 下方關聯編輯器選擇 MyEclipse XML Editor 單擊default按鈕設置爲默認 單擊OK保存退出即可