日期:2014-05-17  浏览次数:20887 次

JSP页面传值给action后出问题,求解答
先上代码:
页面部分: <s:iterator value="dingdans" status="dingdan">
<td class=forumrow  height=24><s:property value="dingdanId" /></td>
<td class=forumrowhighlight  height=24><s:property value="dingdanShijian"/></td>
<td class=forumrow  height=24><s:property value="user.userName"/></td>
<td class=forumrowhighlight  height=24><s:property value="user.dianhua"/></td>
<td class=forumrow  height=24><s:property value="user.dizhi"/></td>
<td class=forumrowhighlight  height=24><s:property value="zongjia"/>元 </td>
<td class=forumrow  height=24><s:property value="zhuangtai"/></td>
<s:if test=" zhuangtai == '提交'">
<td class=forumrowhighlight  height=24>           
     <%-- <s:a href='updateDingdan.action?dingdanId="<s:property value="dingdanId" />"'> 处理</s:a>  --%> 
     
    <form action="updateDingdan.action">
    <input type="hidden" name="dingdanId" value="<s:property value="dingdanId" />">
    <input type="submit" value="处理">
    </form> 
</td>
</s:if>
action部分 public String updateDingdan() throws Exception {
DingdanDAO dingdanDAO=new DingdanDAO();
if(dingdanDAO.updateDingdan(dingdanId)) {
return SUCCESS;
    }else{
    return INPUT;
    }
}
dao部分 public boolean updateDingdan(int dingdanId){
boolean flag=false;
DingdanDAO dingdanDAO=new DingdanDAO();
Dingdan dingdan=dingdanDAO.getDingdanById(dingdanId);
String sql="update  dingdan set userId=?,zhuangtai=?,dingdanShijian=?,zongjia=?  where dingdanId='"+dingdan.getDingdanId()+"'";
try{
Connection conn=DBConn.getConnection();
PreparedStatement pstmt=conn.prepareStatement(sql);

pstmt.setInt(1, dingdan.getUserId());
pstmt.setString(2, "已处理");
pstmt.setDate(3, new java.sql.Date(dingdan.getDingdanShijian().getTime()));
pstmt.setInt(4, dingdan.getZongjia());

if(pstmt.executeUpdate()>0){
flag=true;
}
pstmt.close();
conn.close();
}catch (Exception e){
e.printStackTrace();
}
return flag;
}
错误为
com.microsoft.sqlserver.jdbc.SQLServerException: 结果集没有当前行。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:130)
at com.microsoft.sqlserver.jdbc.SQLServerResultSet.verifyResultSetHasCurrentRow(SQLServerResultSet.java:314)
at com.microsoft.sqlserver.jdbc.SQLServerResultSet.getterGetColumn(SQLServerResultSet.java:1785)
at com.microsoft.sqlserver.jdbc.SQLServerResul