Struts2中关于"There is no Action mapped for namespace / and action name"的报错的总结

本文讲述了在使用Struts框架时遇到的一个常见问题:如果配置文件的名字不是标准的struts.xml,则可能会导致页面无法正确跳转。文章通过实例展示了正确的配置文件命名及基本配置方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

刚开始我的struts配置文件名为struts-front.xml,然后就一直无法跳转到指定页面,报“There is no Action mapped for namespace / and action name”这个错。后来把名称改成标准的struts.xml就正常了。看来这个配置文件命名是有规定的啊,不能随便改,切记!

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
    "http://struts.apache.org/dtds/struts-2.1.7.dtd">
<struts>
<!-- 前台登录 -->
<package name="user" extends="struts-default" namespace="">
<action name="login" method="" class="loginAction">
<result name="index" type="dispatcher">index.jsp</result>
<result name="error" type="dispatcher">error.jsp</result>
</action>
</package>
</struts>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值