当前位置: 代码迷 >> Java Web开发 >> SSH JSP页面跳转UPDATE方法貌似没有用,该如何解决
  详细解决方案

SSH JSP页面跳转UPDATE方法貌似没有用,该如何解决

热度:725   发布时间:2016-04-17 00:33:04.0
SSH JSP页面跳转UPDATE方法貌似没有用
//daoimpl
public void updateStu(Student stu) throws Exception {
this.getHibernateTemplate().update(stu);

}
//bizimpl
public void updateStu(Student stu) throws Exception {
// TODO Auto-generated method stub
studao.updateStu(stu);
}
//action
public String updateStu()throws Exception{
try {
stubiz.updateStu(stu);
System.out.println(stu.getSid()+stu.getSname()+stu.getSage());
return SUCCESS;
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
return INPUT;
}

//jsp
 <body>
  <form action="updatestu.action" method="post">  
  <table>  
  <tr>
  <td>姓名:</td>
  <td><input type="text" value="${stu.sname }"></input></td>
  </tr> 
  <tr>
  <td>年龄:</td>
  <td><input type="text" value="${stu.sage }"></input></td>
  </tr>  
  <tr>
  <td>住址:</td>
  <td><input type="text" value="${stu.sadress }"></input></td>
  </tr>  
  <tr>
  <td>联系电话:</td>
  <td><input type="text" value="${stu.sphone }"></input></td>
  </tr>
  <tr>
  <td>所在学校:</td>
  <td><input type="text" value="${stu.school }"></input></td>
  </tr>
  </table>
  <input type="submit" value="更新">
  <input type="button" value="删除" onclick="javascript:location.href='delstu.action?id=${sid}'">
  </form>
  </body>


//struts.xml

 <package name="mintao" extends="struts-default">
  <action name="zw" class="stuaction">
  <result type="redirectAction">getall</result>
  <result name="input">addstu.jsp</result>
  </action>
  <action name="getall" class="stuaction" method="getall">
  <result>showlist.jsp</result>
  <result name="input">addstu.jsp</result>
  </action>
  <action name="delstu" class="stuaction" method="delStudent">
  <result type="redirectAction">getall</result>
  <result name="input">detail.jsp</result>
  </action>
  <action name="/updatestu" class="stuaction" method="updateStu">
  <result type="redirectAction">getall</result>
  <result name="input">detail.jsp</result>
  </action>
  <action name="getstu" class="stuaction" method="getStuById">
  <result>detail.jsp</result>
  <result name="input">showlist.jsp</result>
  </action>
 </package>

目前其他增删查都没有问题,就是更新一直是原来那样,是在不知道是哪出了问题了。
调试的时候进入了方法,但是感觉没起到任何作用。

------解决方案--------------------
  相关解决方案