Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <c:url var="addAction" value="/students/add"/>
- <form:form action="${addAction}" commandName="student">
- <table>
- <c:if test="${!empty student.name}">
- <tr>
- <td>
- <form:label path="id">
- <spring:message text="ID"/>
- </form:label>
- </td>
- <td>
- <form:input path="id" readonly="true" size="8" disabled="true"/>
- <form:hidden path="id"/>
- </td>
- </tr>
- </c:if>
- <tr>
- <td>
- <form:label path="name">
- <spring:message text="Имя"/>
- </form:label>
- </td>
- <td>
- <form:input path="name"/>
- </td>
- </tr>
- ...
- <tr>
- <td colspan="2">
- <c:if test="${!empty student.name}">
- <input type="submit"
- value="<spring:message text="Изменить студента"/>"/>
- </c:if>
- <c:if test="${empty student.name}">
- <input type="submit"
- value="<spring:message text="Добавить студента"/>"/>
- </c:if>
- </td>
- </tr>
- </table>
- @RequestMapping(value = "/students/add", method = RequestMethod.POST)
- public String addStudent(@ModelAttribute("student") Student student){
- this.studentService.addStudent(student);
- return "redirect:/students";
- }
Add Comment
Please, Sign In to add comment