tags:

views:

1099

answers:

2

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">
    <interceptors>
        <interceptor-stack name="crudStack">
            <interceptor-ref name="checkbox" />
            <interceptor-ref name="params" />
            <interceptor-ref name="static-params" />
            <interceptor-ref name="defaultStack" />
        </interceptor-stack>
    </interceptors>
</package>

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

<struts>
<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>
    </action>

</package>

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....

A: 

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".

Nirmal
A: 

I don't know what version of struts2 you're using but if you're using the 2.1.x branch you should look at the convention plugin http://cwiki.apache.org/S2PLUGINS/convention-plugin.html. You can get rid of 99% XML configuration.

Ruggs