Struts2异常:HTTP Status 404 - There is no Action mapped for action name addBook.
HTTP Status 404 - There is no Action mapped for action name addBook.

在地址栏进行访问的时候,出现了这个错误信息,导致出现此异常的原因可能有如下的三个原因:
1. 可能是struts.xml文件的名称或者位置写错。
2. 可能是struts.xml文件的内容错误。
3. 可能是因为struts.xml文件按照分模块的方式进行编辑,没有将模块下的xml文件引入到struts的核心配置文件struts.xml中(我的异常因为这个原因)
正确的struts.xml模板:
1. 分模块struts.xml和book.xml(struts.xml核心配置文件,book.xml模块配置文件。只需要将book.xml引入到struts.xml)
book.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<package name="bookaction" extends="struts-default" namespace="/book">
<action name="addBook" class="cn.geore.bookaction.BookAction" method="addBook">
<result name="success">/jsps/one/addBook.jsp</result>
</action> <action name="updateBook" class="cn.geore.bookaction.BookAction" method="updateBook">
<result name="success">/jsps/one/updateBook.jsp</result>
</action>
</package>
</struts>
struts.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<constant name="struts.i18n.encoding" value="UTF-8"></constant>
<!-- 引入外部的Struts模块的配置文件 -->
<!-- <include file="cn/geore/action/one.xml"></include> -->
<include file="cn/geore/bookaction/book.xml"></include>
</struts>
2. 不分模块的struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<package name="bookaction" extends="struts-default" namespace="/book">
<action name="addBook" class="cn.geore.bookaction.BookAction" method="addBook">
<result name="success">/jsps/one/addBook.jsp</result>
</action> <action name="updateBook" class="cn.geore.bookaction.BookAction" method="updateBook">
<result name="success">/jsps/one/updateBook.jsp</result>
</action>
</package>
</struts>
Struts2异常:HTTP Status 404 - There is no Action mapped for action name addBook.的更多相关文章
- Struts2异常:HTTP Status 404 - /Struts2/book/addBook.action
HTTP Status 404 - /Struts2/book/addBook.action 如果在Struts2的框架中访问路径出现了这个错误,可能存在的原因有如下的两个: 1. 路径写错,也就是a ...
- 68. 使用thymeleaf报异常:Not Found, status=404【从零开始学Spring Boot】
[从零开始学习Spirng Boot-常见异常汇总] 我们按照正常的流程编码好了 controller访问访问方法/hello,对应的是/templates/hello.html文件,但是在页面中还是 ...
- TOMCAT报错:HTTP Status 404 -
构建struts2工程师,tomcat报错: HTTP Status 404 - type Status report message description The requested resour ...
- JavaEE SSH框架整合(三) struts2 异常、http错误状态码处理
struts2的action可能出现訪问不到,或action报异常等情况,所以须要作一些处理,给用户一个友好的印象. 1. 异常处理 result声明在action中 <action name ...
- 在IE浏览器输入测试servlet程序报:HTTP Status 404(The requested resource is not available)错
一.HTTP Status 404(The requested resource is not available)异常主要是路径错误或拼写错误造成的,请按以下步骤逐一排查: 1.未部署Web应用 2 ...
- 报错: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 <s:iterator> status属性
struts2 <s:iterator> status属性 转载▼ iterator标签主要是用于迭代输出集合元素,如list set map 数组等,在使用标签的时候有三个属性值得我 ...
- Jsp——http status 404 问题
今天学习Jspapplication内置对象的时候突然碰到了一个问题——http status 404 发生了什么? 提示The requested resource is not available ...
- 在写ssh项目时浏览器页面出现http status 404 – not found
HTTP Status 404 - /streetManager/index.jsp type Status report message /streetManager/index.jsp descr ...
随机推荐
- Java Annotation 刷课笔记(一)
1.什么是注解? 1.1.Annotation是从JDK5.0引入的新技术 1.2.Annotation的作用: 不是程序本身,可以对程序作出解释(这一点,和注释没什么区别) 可以被其他程序(比如编译 ...
- SpringBoot之初体验
一.SpringBoot 介绍 1.1 SpringBoot 使命 在之前我们学习 Spring 时,我们了解到 Spring 最根本的使命就是 简化Java开发.而 SpringBoot 的出现也有 ...
- 【leetcode】1111. Maximum Nesting Depth of Two Valid Parentheses Strings
题目如下: A string is a valid parentheses string (denoted VPS) if and only if it consists of "(&quo ...
- 6353. 【NOIP2019模拟】给(ca)
题目描述 题解 虫合 由于前几天被教♂育了,所以大力找了一发规律 先把m-1,设f[i][j]表示m≤i,有j个叶子节点的答案 转移显然,也显然是O(n^3)的 把f打出来后长这样: 1 1 1 1 ...
- dede后台系统基本参数空白怎么办?
dede后台系统基本参数空白怎么办? 如图: 解决办法:还原dede_sysconfig表即可 后台 系统-SQL命令行工具,执行如下sql delete table dede_sysconfig ...
- Java大文件上传详解及实例代码
1,项目调研 因为需要研究下断点上传的问题.找了很久终于找到一个比较好的项目. 在GoogleCode上面,代码弄下来超级不方便,还是配置hosts才好,把代码重新上传到了github上面. http ...
- [CSP-S模拟测试]:e(树上主席树)
题目传送门(内部题66) 输入格式 第一行,一个正整数$n$,一个自然数$q$,一个整数$type$.第二行,$n$个正整数,代表$a_i$.接下来$n-1$行,每行两个正整数$u$.$v$,代表树中 ...
- C++ Boost库的编译及使用
https://www.jianshu.com/p/de1fda741beb https://www.cnblogs.com/weizhixiang/p/5804778.html Windows编译 ...
- anaconda 下载包速度慢
更新清华镜像资源 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda ...
- 2019年CCPC网络赛 HDU 6703 array【权值线段树】
题目大意:给出一个n个元素的数组A,A中所有元素都是不重复的[1,n].有两种操作:1.将pos位置的元素+1e72.查询不属于[1,r]中的最小的>=k的值.强制在线. 题解因为数组中的值唯一 ...