struts.action.excludePattern 不起作用,
struts.action.excludePattern 在 Struts 2 中对我不起作用,我将 servlet cal 放在表单操作中,表单将在超链接单击时提交。
struts.xml:
<constant name="struts.action.excludePattern" value="/PunchoutOrder"/>
web.xml
<servlet>
<description></description>
<display-name>PunchoutOrder</display-name>
<servlet-name>PunchoutOrder</servlet-name>
<servlet-class>com.PunchoutOrder</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>PunchoutOrder</servlet-name>
<url-pattern>/PunchoutOrder</url-pattern>
</servlet-mapping>
jsp:
<form id="form1" name = "form1" method="post" action="PunchoutOrder">
<input type="image" alt="Submit" src="images/submit.png" onclick="Submit(form1);return false;"/>
低于错误:
15:26:37,512 WARN [Dispatcher] Could not find action or result
There is no Action mapped for namespace / and action name PunchoutOrder. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:475)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
我错过了什么吗……?
谢谢.....
struts.action.excludePattern is not working for me in Struts 2, i had place servlet cal in form action, form will submit on hyperLink click.
struts.xml:
<constant name="struts.action.excludePattern" value="/PunchoutOrder"/>
web.xml
<servlet>
<description></description>
<display-name>PunchoutOrder</display-name>
<servlet-name>PunchoutOrder</servlet-name>
<servlet-class>com.PunchoutOrder</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>PunchoutOrder</servlet-name>
<url-pattern>/PunchoutOrder</url-pattern>
</servlet-mapping>
jsp:
<form id="form1" name = "form1" method="post" action="PunchoutOrder">
<input type="image" alt="Submit" src="images/submit.png" onclick="Submit(form1);return false;"/>
Getting below Error:
15:26:37,512 WARN [Dispatcher] Could not find action or result
There is no Action mapped for namespace / and action name PunchoutOrder. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:475)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
Am i missing something...........?
Thank you.....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我遇到了同样的问题,并遇到了一些如何解决它的提示。然而,我发现的解决方案(至少在 Struts 2.2.2 中)是我在 web.xml 中使用了错误的过滤器。经过一番挖掘 Google 和 SO 帖子后,我发现从: 更改
为:
更改过滤器后,struts.xml 中的排除模式常量立即开始按预期运行。
这也记录在此处: https://cwiki.apache.org/confluence/display/S2WIKI/Troubleshooting+guide+migration+from+Struts+2.0.x+to +2.1.x#TroubleshootingguidemigrationfromStruts2.0.xto2.1.x-FilterMapping%2CdefaultActionextensions%2CandServlets
虽然前面的条目说要显式声明操作扩展,但我发现在修复过滤器声明后没有必要。
I was having the same problem and ran into several hints at how to fix it. However the solution I found, at least in Struts 2.2.2 was that I was using the wrong filter in my web.xml. After some digging through Google and SO posts I found that changing from:
To:
After changing the filter, my exclusion pattern constant in the struts.xml immediately started functioning as expected.
This is also documented here: https://cwiki.apache.org/confluence/display/S2WIKI/Troubleshooting+guide+migrating+from+Struts+2.0.x+to+2.1.x#TroubleshootingguidemigratingfromStruts2.0.xto2.1.x-FilterMapping%2CdefaultActionextensions%2CandServlets
Although the previous entry says to explicitly declare the action extensions, I found it was unnecessary after fixing my filter declaration.
看来你的语法不完全正确。我遇到了同样的问题,纠正正则表达式对我有用。将行添加
到我的 struts.xml 后,一切都按预期工作。此路径中的请求现在返回 404 错误,而不是 struts 错误消息“没有为命名空间映射的操作...”
欢呼
it seems as if your syntax isn't entirely correct. I fell upon the same issue and correcting the regular expression worked for me. After adding the line
to my struts.xml, everything works as expected. Request within this path are now returned with 404 errors instead of struts error message "There is no Action mapped for namespace ..."
cheers
在 web.xml 中,在 servlet url 模式中添加 .extention
In web.xml add .extention in servlet url pattern