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 作为程序开发人员,我们经常需要对一个实际上程序性的系统应用面向对象的方法.商业分 ...
随机推荐
- spring aop pointcut 切入点是类的公共方法(私有方法不行),还是接口的方法
spring aop pointcut 切入点是类的公共方法(私有方法不行),还是接口的方法 类的公共方法可以,但是私有方法不行 测试一下接口的方法是否能够捕捉到
- My.Ioc 的性能
IoC/DI 这个概念,最初是由 Martin Fowler 提出来的.之后,很快在 Java 社区大行其道.在 .net 社区,IoC 的流行要比 Java 晚一些.尽管如此,现在开源社区中也已经出 ...
- trie树信息抽取之中文数字抽取
这一章讲一下利用trie树对中文数字抽取的算法.trie树是一个非常有用的数据结构,可以应用于大部分文本信息抽取/转换之中,后续会开一个系列,对我在实践中摸索出来的各种抽取算法讲开来.比如中文时间抽取 ...
- 解决WebService本地访问正常,远程无法访问的问题
发布webservice后部署到自己的服务器上,然后本机,外网远程访问都没事,在用户服务器上部署后只能本机访问,远端访问不了,通过网络搜索到下面方法,但改后仍然不行.原来在自己服务器部署时是在默认网站 ...
- 如何写angularJS模块
angularJS中提供模块的概念,供我们把代码封装在模块单元中,使用模块能给我们带来的好处 保持全局命名空间的清洁 易于在不同应用间复用代码 demo.html <!doctype html& ...
- mysql存储过程的权限 definer
mysql中用户对存储过程的权限有: ALTER ROUTINE 编辑或删除存储过程 CREATE ROUTINE 创建存储过程 EXECUTE运行存储过程 存储过程的创建者拥有存储过程的ALTER. ...
- python函数参数的pack与unpack
python函数参数的pack与unpack 上周在使用django做开发的时候用到了mixin(关于mixin我还要写一个博客专门讨论一下,现在请参见这里),其中又涉及到了一个关于函数参数打包(pa ...
- bzoj1188: [HNOI2007]分裂游戏
Description 聪聪和睿睿最近迷上了一款叫做分裂的游戏. 该游戏的规则试: 共有 n 个瓶子, 标号为 0,1,2.....n-1, 第 i 个瓶子中装有 p[i]颗巧克力豆,两个人轮流取豆子 ...
- 在controller写sql在mapper拼接
这是在controller里面: String search = ""; if("null".equals(start_time)||"". ...
- Scut:GameWebSocketHost 解析
想使用 Scut 做的是一个短连接项目,所以先直接看 GameWebSocketHost 了. 先来看下 GameWebSocketHost 的成员: protected bool EnableHtt ...