支持绑定表单对象

jsp:

<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<
form:form id="itemForm" action="${pageContext.request.contextPath }/items/editItemSubmit.action" method="post" modelAttribute="items"> <form:input path="id" type="hidden"/> 修改商品信息: <table width="100%" border=1> <tr> <td>商品名称</td> <td><form:input path="name" /></td> </tr> <tr> <td colspan="2" align="center"> <input type="submit" value="提交"/> </td> </tr> </table> </form:form>

controller:

@RequestMapping("/editItemSubmit")
    public String editItemSubmit(@ModelAttribute Items items,Model model){
        itemsService.updateItems(items);
        System.out.println(items);
        return "forward:list.action";
    }

 

重点是<form:input/>中的modelAttribute

撸的精尽人亡...

相关文章:

  • 2022-03-06
  • 2021-07-29
  • 2021-12-15
  • 2021-06-28
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
猜你喜欢
  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2021-10-08
  • 2022-12-23
相关资源
相似解决方案