Jatin Balodhi Jatin Balodhi - 5 months ago 18
Java Question

getting error in struts.xml

while creating just a sample struts application, i'm getting error in my struts.xml file

"the element of content type "struts" must match "package|include|bean|constant"
i check the the file again and searched on web but not getting anything related to problem.

struts.xml


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<pacakage name="default" extends="struts-default">
<action name="getTutorial" class="org.jatin.TutorialAction">
<result name="success">/Success.jsp</result>
<result name="failure">/failure.jsp</result>
</action>
</pacakage>
</struts>




thanks

Answer

You have a typo in your struts.xml file:

<pacakage name="default" extends="struts-default">

You mispelled package as pacakage. Use this file instead:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.3.dtd"> 
<struts>
    <package name="default" extends="struts-default">
        <action name="getTutorial" class="org.jatin.TutorialAction">
            <result name="success">/Success.jsp</result>
            <result name="failure">/failure.jsp</result>
        </action>
    </package>
</struts>
Comments