spring - In Thymeleaf with multiple actions and multiple forms are possible? -
hi new in thymeleaf + spring , start learn it. , wanted integrate these 2 form in one page .
that means now 2 forms in 2 different pages , th:action different ..
here want these 2 forms work in 1 page
i tried page 2 forms , 2 actions caught error..
create standard code
<form action="#" th:action="@{/savestandard.html}" th:object="${standard}"> <table> <h1>create standard</h1> <tr> <td>standard name:</td> <td><input type="text" placeholder="enter standard name" required="required" th:field="*{standardname}"/></td> </tr> <tr> <td><input type="submit" value="create" name="save" /></td> </tr> </table> </form>
create division code
<form action="#" th:action="@{/savedivision.html}" th:object="${division}"> <table> <td>division name:</td> <tr> <td><input type="text" placeholder="enter division name" required="required" th:field="*{divisionname}" /> </td> </tr> <td><input type="submit" class="btn btn-primary" value="create" name="save" /></td> </table> </form>
these controllers..
@requestmapping(value = array("/savestandard.html"), params = array({ "save" })) def savestandard(standard: standard): string = { standard.setcreateddate(new java.sql.date(new java.util.date().gettime)) standardservice.addstandard(standard) "redirect:/school/createstandard.html" } @requestmapping(value = array("/savedivision.html"), params = array({ "save" })) def savedivision(division: division): string = { division.setcreateddate(new java.sql.date(new java.util.date().gettime)) divisionservice.adddivision(division) "redirect:/school/createdivision.html" }
if knew question please share answer here..
and thanks...
Comments
Post a Comment