Java 警告:未找到指定操作的配置:在命名空间中:表单操作默认为“action”属性的文字值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20641441/
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
WARNING: No configuration found for the specified action: in namespace: Form action defaulting to 'action' attribute's literal value
提问by sunleo
I am trying to find the namespace and action name with wildcards but it gets failed.
我正在尝试使用通配符查找命名空间和操作名称,但它失败了。
Exception :
例外 :
WARNING: No configuration found for the specified action: '/checkMethods/executeCRUD' in namespace: ''. Form action defaulting to 'action' attribute's literal value.
XML :
XML :
<package name="crudAction" namespace="/checkMethods" extends="struts-default" >
<action name="*CRUD" class="leo.struts.HelloWorldAction" method="{1}">
<result name="success" >/crud.jsp</result>
</action>
</package>
HTML:
HTML:
<body>
Action so Far : <s:property value="message"/>
<s:form action="/checkMethods/deleteCRUD" >
<s:submit label="delete"/>
</s:form>
<s:form action="/checkMethods/selectCRUD" >
<s:submit label="select"/>
</s:form>
<s:form action="/checkMethods/updateCRUD" >
<s:submit label="update"/>
</s:form>
<s:form action="/checkMethods/executeCRUD" >
<s:submit label="execute"/>
</s:form>
</body>
Please help me to solve this.
请帮我解决这个问题。
采纳答案by Roman C
in the action attribute you should specify the action name without slashes. Like
在 action 属性中,您应该指定不带斜杠的动作名称。喜欢
<s:form namespace="/checkMethods" action="deleteCRUD" >
That would resolve action mapping but it will not save you from updating data. Having multiple forms on the page separate the input fields by the form tag. If you want to have several buttons mapped to each own action that operate on the same data then you should create one form and several submit tags, each tag map to the method or action. See thisanswer how to do it.
这将解决动作映射,但它不会使您免于更新数据。页面上的多个表单通过表单标签分隔输入字段。如果您希望将多个按钮映射到对相同数据进行操作的每个自己的操作,那么您应该创建一个表单和多个提交标签,每个标签都映射到方法或操作。请参阅此答案如何操作。