There is no Action mapped for namespace [/] and action name [abc_show] associated with context path [/helloStruts].

There is no Action mapped for namespace [/] and action name [abc_show] associated with context path [/helloStruts].

发现问题:页面找不到

image-20220102221756337

分析问题:页面找不到,提示是我的映射问题。但是当我在struts.xml文件从正常命名更改为通配符时就会出现报错,提示如上。

环境:struts2(2.5版本)

解决问题:可能是因为2.5的版本,所以比较严谨

<!--允许动态调用方法,通配符+占位符组合,必须加上这行代码  2.5版本-->
	<constant name="struts.enable.DynamicMethodInvocation"
		value="true" />
	<constant name="struts.devMode" value="false"/>

<!--报错时 Method 方法 for action Action is not allowed 添加global-allowed-methods 
			表示允许动态调用的方法 2.5版本-->
		<global-allowed-methods>regex:.*</global-allowed-methods>
image-20220102224003892

保存,重新启动服务器就可以了。

posted @ 2022-01-03 19:03  DawsonDragon  阅读(33)  评论(0)    收藏  举报