Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Incomplete
-
1.1.0
-
None
-
None
-
Operating System: other
Platform: PC
-
27314
Description
Tomcat5 throws an exception if <form-beans> tag is not the first tag after
<config-struts> in struts-config.xml.
Sample File:
---------------------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<global-forwards>
<forward name="welcome" path="/Welcome.do"/>
</global-forwards>
<form-beans>
<form-bean name="userFormBean" type="coreservlets.UserFormBean"/>
</form-beans>
<action-mappings>
<action
path="/Welcome"
type="org.apache.struts.actions.ForwardAction"
parameter="/pages/Welcome.jsp">
</action>
<action
path="/actions/register1"
type="coreservlets.RegisterAction1">
<forward name="success"
path="/WEB-INF/results/result1.jsp">
</forward>
</action>
<action
path="/actions/register2"
type="coreservlets.RegisterAction2">
<forward name="bad-address"
path="/WEB-INF/results/bad-address2.jsp">
</forward>
<forward name="bad-password"
path="/WEB-INF/results/bad-password2.jsp"/>
<forward name="success"
path="/WEB-INF/results/result2.jsp"/>
</action>
<action
path="/actions/register3"
type="coreservlets.RegisterAction3"
name="userFormBean"
scope="request">
<forward name="bad-address"
path="/WEB-INF/results/bad-address3.jsp"/>
<forward name="bad-password"
path="/WEB-INF/results/bad-password3.jsp"/>
<forward name="success"
path="/WEB-INF/results/result3.jsp"/>
</action>
</action-mappings>
</struts-config>
---------------------------------------------------------------------------
excerpt from tomcat log output:
28.02.2004 18:20:33 org.apache.commons.digester.Digester error
SCHWERWIEGEND: Parse Error at line 52 column 18: The content of element type "st
ruts-config" must match "(data-sources?,form-beans?,global-exceptions?,global-fo
rwards?,action-mappings?,controller?,message-resources*,plug-in*)".
org.xml.sax.SAXParseException: The content of element type "struts-config" must
match "(data-sources?,form-beans?,global-exceptions?,global-forwards?,action-map
pings?,controller?,message-resources*,plug-in*)".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Er
rorHandlerWrapper.java:232)
at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.
java:173)
at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.
java:371)
at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.
java:305)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDVal
idator.java:1918)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator
.java:851)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(
XMLDocumentFragmentScannerImpl.java:1008)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1469)
...
...
---------------------------------------------------------------------------
---------------------------------------------------------------------------
Tomcat starts without errors using this struts-config.xml:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
<form-bean
name="userFormBean"
type="coreservlets.UserFormBean"/>
</form-beans>
<global-forwards>
<forward name="welcome" path="/Welcome.do"/>
</global-forwards>
<action-mappings>
<action
path="/Welcome"
type="org.apache.struts.actions.ForwardAction"
parameter="/pages/Welcome.jsp">
</action>
<action
path="/actions/register1"
type="coreservlets.RegisterAction1">
<forward name="success"
path="/WEB-INF/results/result1.jsp">
</forward>
</action>
<action
path="/actions/register2"
type="coreservlets.RegisterAction2">
<forward name="bad-address"
path="/WEB-INF/results/bad-address2.jsp">
</forward>
<forward name="bad-password"
path="/WEB-INF/results/bad-password2.jsp"/>
<forward name="success"
path="/WEB-INF/results/result2.jsp"/>
</action>
<action
path="/actions/register3"
type="coreservlets.RegisterAction3"
name="userFormBean"
scope="request">
<forward name="bad-address"
path="/WEB-INF/results/bad-address3.jsp"/>
<forward name="bad-password"
path="/WEB-INF/results/bad-password3.jsp"/>
<forward name="success"
path="/WEB-INF/results/result3.jsp"/>
</action>
</action-mappings>
</struts-config>