Struts1.3 HTTP Status 500 No action config found for the specified url

HTTP Status 500 - org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url

利用Struts1.3 MVC框架编写一个小例程,struts配置如下图所示:


项目的文件目录如下图所示:


入口jsp是person.jsp,为一个添加人员信息表单,对应的Form Bean 和Action是PersonForm和PersonAction,在personAction中进行分流,action为add时是person.jsp表单,action为list时列出所有的人员信息。addSuccess为添加成功后的页面,包含向list页面的跳转。代码如下:

<html:html lang="true">
  <head>
    <html:base />
    
    <title>addSuccess.jsp</title>

	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    This a struts page. <br>
    	${pageContext.request.contextPath }		<br>
    	添加人员成功。<a href="person.do?action=list">返回人员列表</a>
  </body>
</html:html>
打开浏览器进行测试,在addSuccess页面向list页面进行跳转时,出现如下错误,浏览器uri如下:

查找原因:排除action的配置文件错误;那么就是跳转的路径问题。在地址栏输入:http://localhost:8080/Struts1MVCTest/form/person.do?action=list发现同样出现如下错误,去掉中间的/form路径之后能够显示出列表。

原因是:以person.do?action=list为路径直接访问的URL是http://localhost:8080/Struts1MVCTest/form/person.do?action=list,在/form下提交.do的话struts不会处理,需要在/Struts1MVCTest下提交.do文件。

因此需要将链接的路径修改为:<a href="${pageContext.request.contextPath }/person.do?action=list">返回人员列表</a>。这样就可以解决这个问题了。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值