There is no Action mapped for namespace [/] and action name [user!list] associated with context path

也许许多人用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中加入

<constant name="struts.enable.DynamicMethodInvocation" value="true"/>,或者将ture改成false,如果没有,还是会报错。

如下:

<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="true"/>


<package name="userInfo" namespace="/" extends="struts-default">
<action name="user" class="com.java.action.UserAction">
</action>

</package>

4、struts.xml内容

使用默认命名空间就够了.

 5、web.xml中的 

<welcome-file-list>
    <welcome-file>helloWorld.jsp</welcome-file>
  </welcome-file-list>

一定要和helloWorld.jsp相对应

参考:

https://blog.csdn.net/qq_21004057/article/details/79252151

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值