struts2.xml – can’t include other .xml file Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of struts2.xml – can’t include other .xml file without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I am using struts2, for that my struts.xml file contains code like :

<?xml version="1.0" encoding="UTF-8" ?>

<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />

<include file="strutsAuthentication.xml"/>

<package name="default" extends="struts-default">
        <interceptor-stack name="crudStack">
            <interceptor-ref name="checkbox" />
            <interceptor-ref name="params" />
            <interceptor-ref name="static-params" />
            <interceptor-ref name="defaultStack" />

And i have specified all the required actions inside the strutsAuthentication.xml. That code is :

<package name="authentication" extends="default" namespace="/authentication">
    <action name="saveCountry" class="saveCountryAction">
        <interceptor-ref name="defaultStack" />
        <result name="success">/savecountry.jsp</result>
        <result name="error">/error.jsp</result>


When i am deploying my application into tomcat, it gives me warning that :

WARN (org.apache.struts2.components.Form:308) – No configuration found for the specified action: ‘saveCountry’ in namespace: ”. Form action defaulting to ‘action’ attribute’s literal value.

It means struts.xml can’t include strutsAuthentication.xml. Anyone have a solution ?? Thanx in advance….


Got d solution…. For above problem i was done a mistake in calling the action from jsp page. So namespace name “authentication” should be included at the time of calling the action class. Final solution is : “authentication/saveCountry.action”.

We are here to answer your question about struts2.xml – can’t include other .xml file - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji