MyEclipse Struts Config Editor打开struts-config.xml时错误的解决方法

来源:互联网 发布:新闻评论 网络直播 编辑:程序博客网 时间:2024/04/28 00:24

  最近几天在MyEclipse中建立工程时,没有使用MyEclipse中的Add Struts Capabilities来加入Struts支持,而是手工进行了配置。

  1、将Struts所需的jar文件copy到WEB-INF/lib目录下

  2、在工程中新建了一个名为"config"的Source Folder,在此文件夹中建立Struts的配置文件struts-config.xml

  3、修改WEB-INF目录下的web.xml

 

 

  然后双击struts-config.xml,准备进行修改,但此时发现默认的MyEclipse Struts Config Editor编辑器打开该文件时出现错误:“org.eclipse.ui.PartInitException: Project newsjq is not configured as a MyEclipse Web-Struts Project. Therefore the MyEclipse Struts Editor may not be used with struts-config.xml. The default XML Editor has been used to open the file instead. ”,此时MyEclipse默认用其MyEclipse XML Editor打开该文件了。

  如何解决这个问题呢?在网上搜索了一下,发现网友巴士飞扬的博客上有一个方法非常有效,用编辑器打开该工程文件夹下的.project文件,在<natures></natures>之间增加一个<nature>com.genuitec.eclipse.cross.easystruts.eclipse.easystrutsnature</nature>配置即可。

 

 

  然后就可以用MyEclipse Struts Config Editor打开该struts-config.xml文件了,这时会在struts-config.xml所在的文件夹(这里为config)下产生一个.struts-config.mex文件,这样在MyEclipse Struts Config Editor中就可以使用其Design视图模式了。

原创粉丝点击