今天在调试一个基础的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"的总结的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. 报错: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 ...

  5. 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 ...

  6. 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 ...

  7. There is no Action mapped for namespace / and action name UserAction

    果断收藏了,说的非常具体.刚開始学习的人常常遇到的问题. There is no Action mapped for namespace / and action name UserAction 在网 ...

  8. 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 ...

  9. 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 [/] ...

随机推荐

  1. apache无法正常启动,80端口被占用的解决方法

    apache无法正常启动,80端口被占用的解决方法 网上的方法: 仔细查看提示: make_sock: could not bind to address 0.0.0.0:80 恍然大悟,计算机上安装 ...

  2. 20145212 实验五《Java网络编程》

    20145212 实验五<Java网络编程> 一.实验内容 1.运行下载的TCP代码,结对进行,一人服务器,一人客户端: 2.利用加解密代码包,编译运行代码,一人加密,一人解密: 3.集成 ...

  3. Random类

    Random类是随机数产生类,可以指定一个随机数的范围,然后任意产生在此范围中的数字. //================================================= // F ...

  4. Java——包的概念及使用

    package是在使用多个类或接口时,为了避免名称重复而采用的一种措施,直接在程序中加入package关键字即可 编译语法: javac -d . HelloWord.java -d:表示生成目录,生 ...

  5. JavaWeb学习笔记——访问静态HTML网页

    基础知识: 1.一个标准 的WEB应用,在根目录下必须有一个WEB-INF文件夹,文件夹下必须有一个WEB.xml文件. 2.classes文件夹用来存放编译的class文件. 3.lib文件夹用来存 ...

  6. cannot start session without errors

    访问phpmyadmin出现如标题错误,解决方案如下: cd /var/lib/php 更改目录权限chown nginx:nginx -R session/ That's All!

  7. yourphp超出20记录自动删除

    $m = M('service_loginlog'); $res =$m->where('card_id='.$_SESSION['card_id'])->order('time desc ...

  8. awk操作数组注意几点

    awk的数组跟其他程序设计语言的数组有所不同:1.可以直接在awk中定义数组:2.数组元素的初始值为0或空字符串,除非他们被显示的指定初始化:3.数组可以自动扩展:4.都是关联数组,数字下标也会转成字 ...

  9. webservice 服务端例子+客户端例子+CXF整合spring服务端测试+生成wsdl文件 +cxf客户端代码自动生成

    首先到CXF官网及spring官网下载相关jar架包,这个不多说.webservice是干嘛用的也不多说. 入门例子 模拟新增一个用户,并返回新增结果,成功还是失败. 大概的目录如上,很简单. Res ...

  10. HTTP协议详解(真的很经典)

    HTTP 是一个属于应用层的面向对象的协议,由于其简捷.快速的方式,适用于分布式超媒体信息系统.它于1990年提出,经过几年的使用与发展,得到不断地完善和 扩展.目前在WWW中使用的是HTTP/1.0 ...