You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2004/02/28 18:22:18 UTC

DO NOT REPLY [Bug 27314] New: - in config.xml must be the first tag following

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27314>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27314

<form-beans> in config.xml must be the first tag following <struts-config>

           Summary: <form-beans> in config.xml must be the first tag
                    following <struts-config>
           Product: Struts
           Version: 1.1 Final
          Platform: PC
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Unknown
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: piotter@t-online.de


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>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org