WARNING: No configuration found for the specified action:

自闭症网瘾萝莉.ら 提交于 2019-12-10 07:59:08

问题


I am getting following exception, please help to solve this issue.

Jul 16, 2013 11:18:40 AM org.apache.struts2.components.Form evaluateExtraParamsServletRequest
WARNING: No configuration found for the specified action: `'HelloWorld1'` in namespace: `''`. Form action defaulting to 'action' attribute's literal value.

index.jsp:

<s:form action="HelloWorld1" namespace="/" method="post" >
            <s:textfield name="userName" label="User Name" />
            <s:submit />
</s:form>

struts.xml:

<package name="default" namespace="/" extends="struts-default" >
    <action name="HelloWorld1" class="java.vaannila.HelloWorld">
        <result name="SUCCESS">/success.jsp</result>
    </action>
</package>

HelloWorld .java:

public class HelloWorld extends ActionSupport{
       //execute method
   }

回答1:


The error suggests that Struts 2 couldn't load your XML configuration. Make sure your struts.xml is inside WEB-INF/classes directory. (The rest of the configuration looks fine.)




回答2:


If you are sure that the configurations are being loaded properly, try removing the namespace attribute or setting namespace="" instead of namespace="/".




回答3:


This warning appears only when you use devMode. Turn it off and it should disappear, add the following to the struts.xml

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


来源:https://stackoverflow.com/questions/17668970/warning-no-configuration-found-for-the-specified-action

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!