天天看點

SSH中update更新操作無效——要在隐藏域中傳id

一定要在隐藏域中放入主鍵id!  

<s:form action="stu_tosave" theme="simple">

   <input name="type" type="hidden" value="modifytype" />

   <s:hidden name="student.stuid"></s:hidden>

   <table border="1">

    <tr>

     <td>

      姓名

     </td>

      <s:textfield name="student.stuname"></s:textfield>

    </tr>

      性别

      <s:radio list="#{'0':'女','1':'男'}" name="student.stusex"></s:radio>

      年齡

      <s:textfield name="student.stuage" />

      生日

      <input type="text" name="student.stubirth" id="data"

       value="<s:date name='student.stubirth' format='yyyy-mm-dd'/>" />

      愛好

      <s:checkboxlist name="student.stuhobby" list="hobbymap" />

      狀态

      <s:checkbox name="student.stustatus" />

      班級

      <s:select name="student.classes.classid" list="classlist"

       listkey="classid" listvalue="classname"></s:select>

     <td colspan="2">

      <input type="submit" value="儲存" />

   </table>

  </s:form>

繼續閱讀