MyEclipse Struts Config Editor打开struts-config.xml时错误的解决方法
2010-10-15 22:26
423 查看
最近几天在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视图模式了。
1、将Struts所需的jar文件copy到WEB-INF/lib目录下
2、在工程中新建了一个名为"config"的Source Folder,在此文件夹中建立Struts的配置文件struts-config.xml
3、修改WEB-INF目录下的web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <!-- Struts配置 --> <servlet> <servlet-name>Action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/classes/struts-config.xml</param-value> </init-param> <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <!-- 默认页面配置 --> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>
然后双击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>配置即可。
<?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>struts</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>org.eclipse.wst.jsdt.core.javascriptValidator</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.wst.validation.validationbuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature> <nature>com.genuitec.eclipse.j2eedt.core.webnature</nature> <nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.wst.jsdt.core.jsNature</nature> <nature>com.genuitec.eclipse.cross.easystruts.eclipse.easystrutsnature</nature> </natures> </projectDescription>
然后就可以用MyEclipse Struts Config Editor打开该struts-config.xml文件了,这时会在struts-config.xml所在的文件夹(这里为config)下产生一个.struts-config.mex文件,这样在MyEclipse Struts Config Editor中就可以使用其Design视图模式了。
相关文章推荐
- 打开struts-config.xml 报错 解决方法Could not open the editor
- myEclipse 打不开struts-config.xml 报Could not open the editor: An unexpected exception was thrown 错误(转载)
- 打开struts-config.xml 报错 解决办法Could not open the editor
- 解决myeclipse struts editor error (打开struts配置文件的时候,报个这样的编辑器错误)
- myeclipse不能使用默认编辑器打开导入的struts项目的struts-config.xml,Therefore the MyEclipse Struts Editor may not be u
- myEclipse 打不开struts-config.xml 报Could not open the editor: An unexpected exception was thrown 错误(转载)
- 打开struts-config.xml 报错 解决办法Could not open the editor
- myEclipse 打不开struts-config.xml 报Could not open the editor: An unexpected exception was thrown 错误(转载)
- MyEclipse 打开文件的时候会报 Error opening the editor. 错误的解决方法
- myEclipse 打开struts-config.xml无法打开报错!--Error opening the editor
- struts-project.xml无法用MyEclipse JSP Editor打开,报错原因
- MyEclipse 打开Struts配置文件时出错的终级解决办法------Error opening the editor.------at org.eclipse.ui.internal.WorkbenchPage.openEditor
- C# 导出Word报”无法打开Office open xml文件。因为文件内容有错误“ 解决方法
- struts-config.xml 在myeclipse打开是提示 Project xxx is not configured as a MyEclipse Web-Struts Project
- Microsoft Visual Studio 2005打开ISV.config或SiteMap.xml中文显示乱码解决方法
- C# 导出Word报”无法打开Office open xml文件。因为文件内容有错误“ 解决方法
- Weblogic在myEclipse下的启动时 发生Parsing Failure in config.xml的错误解决
- beans.xml cannot be opened错误解决方法(MyEclipse不能自动编译)
- Myeclipse错误:Errors occurred during the build. Errors running builder 'DeploymentBuilder' on project ...解决方法
- [svn]linux下"没有设置 SVN_EDITOR...."错误解决方法