java 警告:未找到指定操作的配置:

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17668970/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-01 14:36:19  来源:igfitidea点击:

WARNING: No configuration found for the specified action:

javastruts2struts

提问by sunleo

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:

index.jsp

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

struts.xml:

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:

HelloWorld .java

public class HelloWorld extends ActionSupport{
       //execute method
   }

采纳答案by Ravi Thapliyal

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

该错误表明Struts 2无法加载您的 XML 配置。确保您struts.xmlWEB-INF/classes目录中。(其余配置看起来不错。)

回答by Kashif Nazar

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

如果您确定正确加载了配置,请尝试删除命名空间属性或设置namespace=""而不是namespace="/".

回答by Roman C

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

此警告仅在您使用devMode. 关闭它,它应该消失,将以下内容添加到struts.xml

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