org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url.
No action config found for the specified url
url路径下找不到action,原因是stuts-config.xml文件配置错误。
demo的项目文件如下:
使用jsp文件夹中的login.jsp文件调用action:
<%@ page language="java" contentType="text/html"pageEncoding="GBK"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>用户登录</title> </head> <body><!-- 标准登录框 --><div id="Login_LoginForm"><div>账号登录</div><form method="post" action="loginng.do">账号:<input name="username" type="text">密码:<input name="password" type="password"><a target="_blank" href="register.jsp">免费注册</a><input type="submit" value="登录"><input type="reset" value="重新输入"></form></div> </body> </html>
web.xml配置文件如下:
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"><display-name>StrutsSample</display-name><servlet><servlet-name>action</servlet-name><servlet-class>org.apache.struts.action.ActionServlet</servlet-class><init-param><param-name>config</param-name><param-value>/WEB-INF/struts-config.xml</param-value></init-param><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>action</servlet-name><url-pattern>*.do</url-pattern></servlet-mapping><welcome-file-list><welcome-file>index.html</welcome-file><welcome-file>index.htm</welcome-file><welcome-file>index.jsp</welcome-file><welcome-file>default.html</welcome-file><welcome-file>default.htm</welcome-file><welcome-file>default.jsp</welcome-file></welcome-file-list></web-app>
struts-config.xml配置文件如下:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts-config PUBLIC"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN""http://struts.apache.org/dtds/struts-config_1_3.dtd"> <struts-config><form-beans><form-bean name="loginForm" type="org.sunnywen.struts.LoginActionForm"></form-bean></form-beans><action-mappings><action path="/loginng"name="loginForm" type="org.sunnywen.struts.LoginAction"><forward name="loginSuccess" path="/index.jsp"></forward></action></action-mappings> </struts-config>
LoginActionForm是继承ActionForm的类,LoginAction是继承Action的类,此时运行将会出现错误:org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url.
原因是JSP文件是在jsp文件夹中,action="loginng.do"会自动去寻找同一文件夹下(即jsp文件夹)的loginng.do,而在struts-config.xml中配置的action的path是配置在根目录下,所以应当如下进行配置:
<action-mappings><action path="/jsp/loginng"name="loginForm" type="org.sunnywen.struts.LoginAction"><forward name="loginSuccess" path="/index.jsp"></forward></action></action-mappings>
转载请注明转载地址:http://www.cnblogs.com/FlyingPuPu/p/5129631.html
转载于:https://www.cnblogs.com/FlyingPuPu/p/5129631.html
org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url.相关推荐
- 开源框架 Apache Struts 2漏洞的 PoC 已公开
聚焦源代码安全,网罗国内外最新资讯! 编译:奇安信代码卫士团队 上周五,GitHub平台上出现了两个 Apache Struts 2 漏洞的PoC,可导致远程代码执行和拒绝服务攻击. 美国网络安全和 ...
- Apache Struts 1宣告退出舞台
近日,Apache官方网站发布了关于Apache Struts 1 EOL(End-Of-Life)新闻稿及通告.该新闻稿指出,2013年4月5日,Apache Struts项目团队正式通知广大开发者 ...
- 你以为它挂了么?并没有!Apache Struts 2.5.22 GA 发布
点击上方蓝色"程序猿DD",选择"设为星标" 回复"资源"获取独家整理的学习资料! 作者 | 局长 来源 | oschina.net/new ...
- Apache Struts 和 Spring 开源漏洞状况的对比
聚焦源代码安全,网罗国内外最新资讯! 编译:奇安信代码卫士 全球的开发人员都依赖多种框架如 Apache Struts 和 Spring 来构建有价值且强大的应用程序. 这些庞大的开源项目是组织机构 ...
- Apache Struts 修复 OGNL 技术中可能存在的 RCE 缺陷
聚焦源代码安全,网罗国内外最新资讯! 编译:奇安信代码卫士团队 Apache 软件基金会发布 Struts 2 安全更新,修复了一个和 OGNL 技术相关的"很可能存在的远程代码执行&qu ...
- 2019年最吸引攻击炮火的 Web 框架:WordPress 和 Apache Struts
聚焦源代码安全,网罗国内外最新资讯! 编译:奇安信代码卫士团队 概要 漏洞风险管理公司 RiskSense 刚刚发布关于顶级 Web 和应用框架漏洞的报告指出,2019年的框架漏洞总量下降但武器化率 ...
- 黑客利用Apache Struts 2漏洞在服务器上传递Cerberus勒索软件
前一阵,我们对Apache Strust 2的CVE-2017-5638漏洞进行了预警,最近F5实验室的研究人员发现Apache Struts 2 漏洞被网络罪犯用于传递Cerber勒索软件. 实际上 ...
- Practical Apache Struts 2 Web 2.0 Projects
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出版.作者信息和本声明.否则将追究法律责任. http://blog.csdn.net/topmvp - topmvp Apache ...
- Struts(七):action配置文件之通配符映射
通配符映射:一个Web应用可能有成百上千个action声明,可以使用struts提供的通配符映射机制把多个彼此相似的映射关系简化为一个映射关系. 通配符映射规则: 若找到多个匹配,没有通配符的那个将胜 ...
最新文章
- SQL Server 常用系统函数和修改字符约束(collate)的修改
- java保存图片进度条_Java上传文件进度条的实现方法(附demo源码下载)
- 【渝粤教育】电大中专学前儿童健康教育 (4)作业 题库
- 形象易懂讲解算法I——小波变换
- 计算机考试中英文打字题,五笔及中英文打字试题(2套)含答案.docx
- 【Java】使用springboot框架中的注解@ManyToOne遇到的坑
- 无法安装Windows Live“OnCatalogResult:0x80190194”错误的解决方法
- C#如何生成随机不重复的数字
- numpy在对数组进行“行过滤“的时候,使用集合运算函数比使用逻辑运算函数更简单
- 中国IT前线战士:蚂蚁雄兵
- 2022年7月国产数据库大事记-墨天轮
- 计算机cpu温度显示原理,电脑cpu温度怎么看
- 吴洪声十问易名CEO金小刚:域名还有没有投资价值?
- 遇到The import org.apache.commons cannot be resolved 的报错
- 生猪价格matlab,基于时间序列的BP神经网络猪肉价格预测
- repo file=sys.stderr 错误完美解决
- hive 修改表结构
- 《听听那冷雨》感受余光中的唯美与浪漫
- adb 由于目标计算机积极拒绝,无法连接。 (10061)
- 企业版小程序申请步骤
热门文章
- Wpf中通过绑定来更新textbox的值
- leetcode —— 面试题12. 矩阵中的路径
- 【差分隐私的指数机制该怎么理解?】差分隐私系统学习记录(三)
- php 显示中文utf,php adodb 从mysql数据库中输出中文显示到utf编码网页乱码问题
- Redis事务及持久化
- 微信小程序 【笔记003】小程序的事件处理
- mysql 32k 限制,MySQL之最大和最小
- html参考文献_学术规范| 参考文献的格式要求和书写规则
- linux7给用户授权,CentOS7 添加新用户并授权
- php生成红包数组,PHP 生成微信红包代码简单