HTTP Status 404 - There is no Action mapped for namespace
[/test] and action name [SecondAction_hello] associated with
context path [/Struct2msb]
![](https://img.haomeiwen.com/i2704327/eb439685b9ecbc0c.png)
配置文件
<action name="*_*" class="com.csy.struct2.{1}" method="{2}">
<result name="success">/{1}_{2}_success.jsp</result>
<result name="fail">/{1}_{2}_fail.jsp</result>
</action>
诡异的是
method="{2}"不使用通配符则正常
解决办法
在struts2.3之前的版本,正常的配置就可以了,但在struts2.3版本之后,使用通配符调用方法时,内部会验证是否允许访问该方法,所以要加上
<allowed-methods>方法名1,方法名2…</allowed-methods>
![](https://img.haomeiwen.com/i2704327/fb533dfc4ec90289.png)
后续文章持续更新中,微信扫码下方二维码免费关注!,点此查看全部最新文章
![](https://img.haomeiwen.com/i2704327/b5b62bcf43f76f74.jpg)
我的博客
我的简书
我的GitHub,喜欢的话给个star吧
网友评论