No result defined for action com.beijing.ac.DataAction and result update

lionfish1973 2015-09-04 02:25:09
在update.jsp页面
调用Data_save时没问题
调用 data!update.action没问题
但调用 Data_update时就出现
No result defined for action com.beijing.ac.DataAction and result update

说是找不到update这result,太奇怪了
数据类型应该没问题啊,应该不会存在数据转换问题吧
我在package也加上namespace上了(不加也是相同的错误)
还会有啥问题可能引起的呢?


下面是struts.xml内容

<struts>
<package name="test" extends="struts-default" namespace="">
<action name="data" class="com.beijing.ac.DataAction">
<result name="findById">/update.jsp</result>
<result name="update" type="redirectAction">/Data_find.action</result>
</action>

<action name="*_*" class="com.beijing.ac.{1}Action" method="{2}">
<result name="input">/input.jsp</result>
<result name="save" type="redirectAction">/Data_find.action</result>
<result name="update" type="redirectAction">/Data_find.action</result>
<result name="delete" type="redirectAction">/Data_find.action</result>
<result name="find">/{2}.jsp</result>
</action>
</package>
</struts>


下面是DataAction.java代码

public class DataAction extends ActionSupport {
//biz接口的声明,用来调用biz
IDataBiz idata;
//这些对象set和get后,都会被hibernate自动放进request里
private Integer daId;
private String daName;
private String daAge;
private List<Datas> datas;
private Datas data;
private int nowPage = 1;
private int pageSize = 5;
private int pageCount;
private int count;


public int getCount() {
return count;
}

public void setCount(int count) {
this.count = count;
}

public int getNowPage() {
return nowPage;
}

public void setNowPage(int nowPage) {
this.nowPage = nowPage;
}

public int getPageSize() {
return pageSize;
}

public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}

public int getPageCount() {
return pageCount;
}

public void setPageCount(int pageCount) {
this.pageCount = pageCount;
}

public List<Datas> getDatas() {
return datas;
}

public void setDatas(List<Datas> datas) {
this.datas = datas;
}

public IDataBiz getIdata() {
return idata;
}

public Integer getDaId() {
return daId;
}

public void setDaId(Integer daId) {
this.daId = daId;
}

public String getDaName() {
return daName;
}

public void setDaName(String daName) {
this.daName = daName;
}

public String getDaAge() {
return daAge;
}

public void setDaAge(String daAge) {
this.daAge = daAge;
}

public void setIdata(IDataBiz idata) {
this.idata = idata;
}

public String save(){
System.out.println("----------------");
System.out.println("save");
data = new Datas();
data.setDaId(daId);
data.setDaAge(daAge);
data.setDaName(daName);
idata.save(data);

System.out.println("保存成功");
return "save";
}
public String delete(){
System.out.println("delete");
System.out.println(daId);
data = new Datas(daId);
idata.delete(data);
return "delete";
}
public String update(){
System.out.println("update");
data = new Datas(daId,daName, daAge);
idata.update(data);
System.out.println("update成功");
return "update";
}

public String findById(){
System.out.println("findById");
data= idata.findById(daId);
daAge = data.getDaAge();
daName = data.getDaName();
daId = data.getDaId();
return "findById";
}
}

下面是update.jsp代码

<%@ page language="java" import="java.util.*" contentType="text/html; charset=gbk"%>
<%@taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>My JSP 'index.jsp' starting page</title>
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>

<body>
================================================<br>
<div align="center">
<form action="Data_save.action" method="post">
姓名<input value="${daName}" type="text"><br>
年龄<input value="${daAge}" type="text"><br>
编号<input value="${daId}" type="text" readonly="readonly"><br>
<input type="submit" value="提交">
</form>

<s:form action="Data_update" method="post">
<s:textfield label="姓名" name="daName"/><br>
<s:textfield label="年龄" name="daAge"/><br>
<s:textfield label="编号" name="daId" readonly="true"/><br>
<s:submit value="提交"></s:submit>
</s:form>

<s:form action="data!update.action">
<s:textfield label="姓名" name="daName"/><br>
<s:textfield label="年龄" name="daAge"/><br>
<s:textfield label="编号" name="daId" readonly="true"/><br>
<s:submit value="提交"></s:submit>
</s:form>
</body>
</html>

...全文
144 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
DY1201 2015-09-08
<struts> <package name="test" extends="struts-default" namespace=""> <action name="data" class="com.beijing.ac.DataAction"> <result name="update" type="redirectAction">/Data_find.action</result> </action> <action name="*_*" class="com.beijing.ac.{1}Action" method="{2}"> <result name="update" type="redirectAction">/Data_find.action</result> </action> </package> </struts>
回复
DY1201 2015-09-08

<struts>
	<package name="test" extends="struts-default" namespace="">
		<action name="data" class="com.beijing.ac.DataAction">
			<result name="findById">/update.jsp</result>
			<result name="update"  	type="redirectAction">/Data_find.action</result>
		</action>
		
		<action name="*_*" class="com.beijing.ac.{1}Action" method="{2}">
			<result name="input">/input.jsp</result>
			<result name="save"   	type="redirectAction">/Data_find.action</result>
			<result name="update"  	type="redirectAction">/Data_find.action</result>
			<result name="delete" 	type="redirectAction">/Data_find.action</result>
			<result name="find">/{2}.jsp</result>
		</action>
	</package>
</struts>    
回复
DY1201 2015-09-08

<struts>
	<package name="test" extends="struts-default" namespace="">
		<action name="data" class="com.beijing.ac.DataAction">
			<result name="findById">/update.jsp</result>
			<result name="update"  	type="redirectAction">/Data_find.action</result>
		</action>
		
		<action name="*_*" class="com.beijing.ac.{1}Action" method="{2}">
			<result name="input">/input.jsp</result>
			<result name="save"   	type="redirectAction">/Data_find.action</result>
			<result name="update"  	type="redirectAction">/Data_find.action</result>
			<result name="delete" 	type="redirectAction">/Data_find.action</result>
			<result name="find">/{2}.jsp</result>
		</action>
	</package>
</struts>    
[code=text]
[/code] 标红的两个都能匹配,你注释其中一个看看
回复
lionfish1973 2015-09-08
请问有人碰到过么
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2015-09-04 02:25
社区公告
暂无公告