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
org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url.的更多相关文章
- 【struts 报错】 No action config found for the specified url
1 type Exception report message org.apache.struts.chain.commands.InvalidPathException: No action con ...
- Struts Chain ClassCastException Aop
我们知道struts的restult type 有很多,但主要就是四种 dispatch,rediret,chain,drdirectaction 要让数据从一个action传到另一个action,就 ...
- org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter与org.apache.struts.dispatcher.FilterDispatcher是什么区别?
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter与org.apache.struts.dispatcher.F ...
- Apache Struts 跨站脚本漏洞
漏洞名称: Apache Struts 跨站脚本漏洞 CNNVD编号: CNNVD-201311-010 发布时间: 2013-11-04 更新时间: 2013-11-04 危害等级: 漏洞类型 ...
- Apache Struts 安全措施绕过漏洞(CVE-2013-4310)
漏洞版本: Apache Group Struts < 2.3.15.2 漏洞描述: BUGTRAQ ID: 62584 CVE(CAN) ID: CVE-2013-4310 Struts2 是 ...
- Apache Struts 多个开放重定向漏洞(CVE-2013-2248)
漏洞版本: Struts < 2.3.15.1 漏洞描述: BUGTRAQ ID: 61196 CVE(CAN) ID: CVE-2013-2248 Struts2 是第二代基于Model-Vi ...
- java org.apache.struts.taglib.html.BEAN 没有找到
index.jsp <body> <a href="login2.do">登陆(struts标签)</a><br> </bod ...
- 在Apache Struts中利用OGNL注入
前言 本文简要介绍了Apache Struts的OGNL注入缺陷,文章中介绍使用简单的应用程序复现OGNL注入.深入研究针对公共漏洞,并理解这类漏洞. 内容 安装Apache Tomcat服务器(入门 ...
- 使用Apache Commons Chain(转载)
原博客出处:http://phil-xzh.iteye.com/blog/321536 使用Commons Chain 作为程序开发人员,我们经常需要对一个实际上程序性的系统应用面向对象的方法.商业分 ...
随机推荐
- Android开发手记(20) 数据存储五 网络存储
Android为数据存储提供了五种方式: 1.SharedPreferences 2.文件存储 3.SQLite数据库 4.ContentProvider 5.网络存储 安卓的网络存储比较简单,因为A ...
- mssql的holdlock锁跟索引的关系
表锁tablock是会给表所有数据附加共享锁,但是只是当前语句有效,语句执行完毕,锁释放,而不会持续到事务结束,而tablockX表锁是持续到事务结束的锁 holdlock锁,锁定的范围会根据wher ...
- ArcGis(01)——地图切片以及发布底图服务
ArcGis(01)——地图切片以及发布底图服务 环境 操作系统:win10_x64 Gis版本:Arcis server 10.2 准备 1.tif格式地图资源 2.Arcis server 10. ...
- bootstrap弹出框居中
1.html页面(如果效果出不来,注意修改单引号) <!DOCTYPE html> <html lang="zh-CN"> <head> < ...
- .ctor,.cctor 以及 对象的构造过程
摘要: .ctor,.cctor 以及 对象的构造过程.ctor:简述:构造函数,在类被实例化时,它会被自动调用.当C#的类被编译后,在IL代码中会出现一个名为.ctor的方法,它就是我们的构造函数, ...
- 《asp.net mvc3 高级编程》第二章 控制器
一.控制器的角色 MVC模式中的控制器(Controller)主要负责响应用户的输入,并且在响应时通常会修改模型(Model).通过这种方式,MVC模式中的控制器主要关注的是应用程序流,输入数据的处理 ...
- jQuery获取JSON格式数据方法
getJSON方法: jQuery.getJSON(url,data,success(data,status,xhr)) $("button").click(function(){ ...
- PHP转换IP地址到真实地址的方法详解
本篇文章是对PHP转换IP地址到真实地址的方法进行了详细的分析介绍,需要的朋友参考下 想要把IPv4地址转为真实的地址,肯定要参考IP数据库,商业的IP数据库存储在关系型数据库中,查询和使用都非常 ...
- 好用的JQ图片特效jquery-poptrox-popup-galleries
jQuery Poptrox – Popup galleries Rate this (1 Vote) Download Demo jQuery Poptrox Adds popup ga ...
- d038: 星罗密布
内容: 输出图形 *****$***$$$*$$$$$ 规律是...自己发现吧. 要求输入3,输出上面三行的图形 输入说明: 行数小于40 输出说明: 输入样例: 3 输出样例 : ***** ...