Parse error in struts-config.xml file

4k Views Asked by At

I am getting the following error in my struts-config.xml

SEVERE: Parse Error at line 6 column 16: Document root element "struts-config", must match DOCTYPE root "form-validation". org.xml.sax.SAXParseException; systemId: jndi:/localhost/SSH/WEB-INF/struts-config.xml; lineNumber: 6; columnNumber: 16; Document root element "struts-config", must match DOCTYPE root "form-validaton

Xml:

 <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE form-validation PUBLIC
                 "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.3.0//EN" "http://jakarta.apache.org/commons/dtds/validator_1_3_0.dtd">  
        <struts-config>
        <form-beans>
        <form-bean name="sform" type="org.apache.struts.action.DynaActionForm">
        <form-property name="sid" type="java.lang.String"/>
        </form-bean>
        </form-beans>
        <global-exceptions/>
        <global-forwards/>
        <action-mappings>
        <action path="/sidSubmit" name="sform" 
        type="org.springframework.web.struts.DelegatingActionProxy" 
        scope="request" 
        input="/search.jsp">
        <forward name="search" path="/search.jsp"/>
        </action>
        </action-mappings>
        <message-resources parameter="com.xxx.xxx.Application"></message-resources>
        <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
        <set-property property="contextConfigLocation" value="/WEB-INF/studentContext.xml"/>
        </plug-in>
        </struts-config>
1

There are 1 best solutions below

0
On

Did you copy paste this file together? It declares a DOCTYPE concerning form validation but contains configuration for a Struts 1.x web app.

Use the correct DOCTYPE for a Struts config file (from the spec):

<!DOCTYPE struts-config PUBLIC
  "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
  "http://struts.apache.org/dtds/struts-config_1_3.dtd">

Assuming Struts 1.3.x here, you might need to change the version referenced in the DOCTYPE declaration.