Struts2中关于"There is no Action mapped for namespace / and action name"的总结
今天在调试一个基础的Struts2框架小程序。总是提示"There is no Action mapped for namespace / and action name"的错误。上网查询后发现这是一个初学者经常碰到的问题,导致错误的原因主要有两种。总结如下:
一、struts.xml文件错误。这种错误又分为以下几种:1,struts.xml文件名错误。一定要注意拼写问题;2,struts.xml文件放置路径错误。一定要将此文件放置在src目录下。编译成功后,要确认是否编译到classes目录中;3,struts.xml文件内容错误。下面给出一个正确的struts.xml文件以供参考。注意背景色部分。

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd"> <struts>
<package name="default" namespace="/" extends="struts-default">
<action name="login" class="com.wanggc.struts2.sample.Struts2Action">
<result name="success">/jsp/result.jsp</result>
</action>
</package>
</struts>

二、如果排除了struts.xml文件的问题,还有一种可能就是,在web.xml文件中的<welcome-file>信息中是否配置了自己工程的启动页面。如果没有配置,地址栏中要输入完成的url,如:http://localhost:8080/Struts2Sample/jsp/login.jsp,如果已配置,地址栏中要输入项目的url,如:http://localhost:8080/Struts2Sample后面的资源详细信息不输入的时候也会报这个错误,这种问题初学者时常遇到。
Struts2中关于"There is no Action mapped for namespace / and action name"的总结的更多相关文章
- struts2中错误There is no Action mapped for namespace [/] and action name [] associated with context path
1 There is no Action mapped for namespace [/] and action name [] associated with context path [/Stru ...
- eclipse中配置struts2出现There is no Action mapped for namespace [/] and action name [Login] associated wi
下午在eclipse中配置struts2时报: There is no Action mapped for namespace [/] and action name [Login] associat ...
- struts2方法无法映射问题:There is no Action mapped for namespace [/] and action name [m_hi] associated with context path []
使用struts的都知道,下面使用通配符定义的方式很常见,并且使用也很方便: <action name="Crud_*" class="example.Crud&q ...
- 报错:HTTP Status 404 - There is no Action mapped for namespace [/] and action name [product-save] associated with context path [/20161101-struts2-2].
运行:index.jsp---->input.jsp----->details.jsp,但是在input.jsp到details.jsp的时候报错误. 异常如下: 严重: Could no ...
- Struts2-tomcat报错:There is no Action mapped for namespace / and action
HTTP Status 404 - There is no Action mapped for namespace / and action name first. type Status repor ...
- There is no Action mapped for namespace [/pages/action/student] and action name [findStudent]
1.错误描写叙述 2014-7-13 2:38:54 org.apache.jasper.compiler.TldLocationsCache tldScanJar 信息: At least one ...
- There is no Action mapped for namespace / and action name UserAction
果断收藏了,说的非常具体.刚開始学习的人常常遇到的问题. There is no Action mapped for namespace / and action name UserAction 在网 ...
- eclipse使用SSH框架出现There is no Action mapped for namespace [/] and action name [] associated with context path错误
eclipse使用SSH框架出现There is no Action mapped for namespace [/] and action name [] associated with conte ...
- Could not find action or result: There is no Action mapped for namespace [/] and action name [GetG
Could not find action or result: /car/GetGpsDataAction There is no Action mapped for namespace [/] ...
随机推荐
- Python2.7安装(win7)
Python可在官方网站直接下,或者百度一下Python2.7下载,这里推荐使用2.7而不是3.3,比较适合初学者 工具/原料 win7系统 python2.7安装包 方法/步骤 1.从官网下载最新的 ...
- Linux下which、whereis、locate、find 命令的区别
1.which 作用:查看可执行文件的位置(通过 PATH环境变量到该路径内查找可执行文件) 语法:which 可执行文件名称 示例: zsm@wilburUbun:/$ which passwd / ...
- 虚拟机NUMA和内存KSM
KSM技术可以合并相同的内存页,即使是不同的NUMA节点,如果需要关闭跨NUMA节点的内存合并,设置/sys/kernel/mm/ksm/merge_across_nodes参数为0.或者可以关闭特定 ...
- new和alloc init的区别
背景说明,new是较为老式的写法,后来发现只有一个new不好使,才引入了alloc和init这种写 法,保留new一是向后兼容,二是很多时候是一种更简单的写法.其实是一样的,new在内部调用 的all ...
- C# ManualResetEvent和AutoResetEvent 使用笔记
一.两者区别 1.ManualResetEvent 调用一次Set()后将允许恢复所有被阻塞线程.需手动在调用WaitOne()之后调用Reset()重置信号量状态为非终止,然后再次调用WaitOne ...
- jQuery中$(function(){})与(function($){})(jQuery)、$(document).ready(function(){})等的区别详细讲解
1.(function($) {…})(jQuery); 1).原理: 这实际上是匿名函数,如下: function(arg){…} 这就定义了一个匿名函数,参数为arg 而调用函数时,是在函数后面写 ...
- acpi和btrfs-安装opensuse时的选项
g-------------------- 关于GPL和LGPL和QPL等 读书笔记:采用LGPL的代码,一般情况下它本身就是一个第三方库(别忘了LGPL最早的名字就是Library GPL),这时候 ...
- SQl语句学习笔记(二)
merge into when matched then... when not mached then... merge into t_road_pre_parameter a fr ...
- 关于PHP位运算的简单权限设计
写在最前面 最近想写一个简单的关于权限处理的东西,之前我也了解过用二进制数的位运算可以出色地完成这个任务.关于二进制数 的位运算,常见的就是“或.与.非”这三种简单运算了,当然,我也查看了下PHP手册 ...
- 【翻译】Tomcat 6.0 部署与发布
本篇参考Tomcat官方文档:<First Webapp>翻译,并结合自己的开发经验介绍关于tomcat部署以及发布的相关内容. 1 目录结构 在tomcat中所有的应用都是放置在CATA ...