有时候我们在编辑配置文件, 写标签时候, 按提示键没有提示, 很不方便, 这时候我们只要有相应的 dtd 文件, 我们就可以关联起来, 让提示键可以用了.
拿 Struts 的配置文件 struts.xml 来说吧.<?xml version="1.0" encoding="UTF-8" ?>
struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
/WEB-INF/views/emp-list.jsp
在 DOCTYPE 中有一个 http://struts.apache.org/dtds/struts-2.3.dtd 赋值这个东西, 然后打开 Eclipse 中的 windows -> preferences -> XML -> XML Catalog, 在右侧 选择 Add
记住: Key type 一定要选择 URL, 否则不会生效的. 如果复制:
-//Apache Software Foundation//DTD Struts Configuration 2.3//EN
这个的话, Key type 就选择 Public ID.
然后点 Ok, 完成配置! 把 struts.xml 文件关闭重新打开, 就有提示了.
大功告成!!!