<form:form action="${pageContext.request.contextPath}/emp" method="POST" modelAttribute="employee">

<br>

<c:if test="${employee.id == null }">

<!-- path 属性对应 html 表单标签的 name 属性值 -->

LastName: <form:input path="lastName"/>

<form:errors path="lastName">

</form:errors>

</c:if>

<c:if test="${employee.id != null }">

<form:hidden path="id"/>

<!-- 将POST请求转化为PUT请求 -->

<input type="hidden" name="_method" value="PUT"/>

</c:if>

<br>

Email: <form:input path="email"/>

<input type="submit" value="Submit"/>

</form:form>

相关文章:

  • 2022-12-23
  • 2018-03-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-07
  • 2021-08-23
  • 2021-09-12
  • 2022-02-25
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案