也许许多人用Struts时一开始会碰到这个错误
There is no Action mapped for namespace [/] and action name [user!list] associated with context path [/PoiDemo2]. - [unknown location]
对于与上下文路径[/ PoiDemo2]相关联的命名空间[/]和操作名称[user!list]没有映射的操作。 - [未知位置]
从网上查看了各种资料,总结起来一般来说有以下几个问题造成
1、struts.xml的名字
struts.xml是struts2的默认配置名字,不要写成其他的如struts2.xml。
2、struts.xml的位置
要确保struts.xml文件在src目录下(好像不一定,不过要编译成功后,确认编译到classes目录中)。
3、如果是动态项目一定要在strurs.xml中加入
,或者将ture改成false,如果没有,还是会报错。
如下:
4、struts.xml内容
使用默认命名空间就够了.
5、web.xml中的
helloWorld.jsp
一定要和helloWorld.jsp相对应
参考:
https://blog.csdn.net/qq_21004057/article/details/79252151