日期:2014-05-20  浏览次数:20607 次

添加数据保存后返回list页面,刷新一次list页面又出现一条一样的数据,为什么呢?
这是Action里面

public String gonewWare(){
warehouse = null;
ActionContext context = ActionContext.getContext();
HttpServletRequest request = (HttpServletRequest)context.get(ServletActionContext.HTTP_REQUEST);
request.setAttribute("controlbiaoshi", "新增");
request.setAttribute("controlkey", "warehousesave");
return SUCCESS;
}
public String saveWare(){
autoServices.savaWarehouse(warehouse);
findAllWare();
return SUCCESS;
}

这是JS

if(type=="warehousenew")
{
document.location.href=server_context+"gonewWare.action";
}
if(type=="warehousesave")
{ document.autowarebouseform.action=server_context+"saveWare.action";
document.autowarebouseform.submit();
}

这是list页面上的新增
<span onclick="controltemp('warehousenew','0','0');">
<table width="90%" border="0" cellpadding="0" cellspacing="0">
<tr> <td>新增</td>
</tr>
</table>
</span>

这是新增页面上的保存
<span  onclick="controltemp('<s:property value="#request.controlkey"/>','0','0');">
<table width="90%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td >保存</td>
</tr>
</table>
</span>


我用的是SSI框架,求高手指点。
ssi,添加

------解决方案--------------------
表单重复提交问题。