日期:2014-05-19  浏览次数:20672 次

【Structs】为什么加入form-bean就错?
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="loginForm" type="com.demo.struts.forms.LoginForm">
          </form-bean>
  </form-beans>
  <global-exceptions />
  <global-forwards />
  <action-mappings>
          <action path="/index" forward="/login.jsp" />
        <action path="/login" name="loginForm" scope="request"
            type="com.demo.struts.actions.LoginAction" input="/login.jsp">
            <forward name="success" path="/welcome.jsp" />
            <forward name="failure" path="/login.jsp" />
        </action>
  </action-mappings>
  <message-resources parameter="com.demo.struts.ApplicationResources" />
</struts-config>


没加<form-bean name="loginForm" type="com.demo.struts.forms.LoginForm"></form-bean>之前,tomcat正常启动,structs正常
加了之后,启动tomcat出现如下错误,structs不能用:
org.apache.catalina.core.StandardContext loadOnStartup
严重: Servlet /demo threw load() exception
javax.servlet.UnavailableException: Parsing error processing resource path /WEB-INF/struts-config.xml
at org.apache.struts.action.ActionServlet.handleConfigException(ActionServlet.java:769)
at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:745)
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:1172)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:992)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4058)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4371)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.refle