Eclipse中建立struts2的配置文件struts.xml
Eclipse中建立struts2的配置文件struts.xml 的步骤:
1、解压最新的struts2包文件,我的是:struts-2.3.8-all.zip(上Struts的官网下载),然后找到struts-2.3.dtd所在路径并复制。(在struts2文件夹下的lib目录,找到struts2-core文件并解压,打开解压的目录下即可找到 struts2.3.dtd 。这里location就选中该文件。)
2、在Eclipse中,选择windows-->Preferences-->在XML文件夹中找到XML Catalog,点击Add.
3、
Location:D:\DOWNLOAD\java\struts\lib\struts-2.3.8\dtd\struts-2.3.dtd--------------->dtd文件所在位置
Key type:public ID
Key:-//Apache Software Foundation//DTD Struts Configuration 2.3//EN-------------->可以从struts-2.3.dtd文件中查找
Alternative web address:http://struts.apache.org/dtds/struts-2.3.dtd-------------->可以从struts-2.3.dtd文件中查找
点击OK!
使用时:
1、new-->XML(Basic Templates)
2、输入文件名:struts.xml,next.
3、选择:Create XML file from DTD file,next.
4、选择:Select XML Catelog entry,会列出所有的XML Catelog entry。
选中刚才输入的:-//Apache Software Foundation//DTD Struts Configuration 2.3//EN,next。
5、一直next,直到ok!