当前位置: 代码迷 >> Java Web开发 >> Myeclipse 8.5部署Struts 1.2 struts-config.xml文件经常出错?解决思路
  详细解决方案

Myeclipse 8.5部署Struts 1.2 struts-config.xml文件经常出错?解决思路

热度:594   发布时间:2016-04-17 11:12:34.0
Myeclipse 8.5部署Struts 1.2 struts-config.xml文件经常出错?
XML code
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"><struts-config>  <data-sources />  <form-beans >    <form-bean name="userForm" type="com.yourcompany.struts.form.UserForm" />  </form-beans>  <global-exceptions />  <global-forwards />  <action-mappings >    <action      attribute="userForm"      input="/form/user.jsp"      name="userForm"      path="/user"      scope="request"      type="com.yourcompany.struts.action.UserAction">      <forward name="succes" path="/succes.jsp" />      <set-property property="cancellable" value="true" />    </action>  </action-mappings>  <message-resources parameter="com.yourcompany.struts.ApplicationResources" /></struts-config>

就是这一行: type="com.yourcompany.struts.action.UserAction">每建一个项目这里都会报错:
用的是Tomcat 6.x
错误信息是:

严重: Parse Error at line 23 column 14: The content of element type "action" must match "(icon?,display-name?,description?,set-property*,exception*,forward*)".
org.xml.sax.SAXParseException: The content of element type "action" must match "(icon?,display-name?,description?,set-property*,exception*,forward*)".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2017)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:901)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2930)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.apache.commons.digester.Digester.parse(Digester.java:1572)
at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:738)
at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:687)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:333)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
  相关解决方案