struts.xml 用include引入多个xml文件时报错

2025-05-22 14:08:59
推荐回答(2个)
回答(1):

更改了struts.xml 的默认地址以后,相当于自己写了个struts.xml 提供给strugs2配置解析器,struts2 不支持struts配置文件多层嵌套(就是说struts。xml include引入的配置文件里不能在进行include),所以你再你自己写的配置文件里引入其他struts业务配置文件,是找不到对应配置的。访问这些肯定会报There is no Action mapped for actionXXX。

回答(2):

在wed.xml中,你的struts2的配置写错了!根本就没有过滤到struts2.所以报出:没有Action映射给sayAction。应该在web.xml中写成:*号是过滤所有action。

struts2
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter



struts2
/*