I have two html templates which do same function, but handled by two different controllers:
1st html handled by moderator controller
<form th:action="@{/moderator/new-user-form}" th:object="${caltest}" method="post"
enctype="multipart/form-data" class="form-validate form row">
<!-- some code -->
</form>
2nd html handled by admin controller
<form th:action="@{/admin/new-user-form}" th:object="${caltest}" method="post"
enctype="multipart/form-data" class="form-validate form row">
<!-- some code -->
</form>
As you can see these templates differ only by action url:
th:action="@{/someurl}"
Is it possible to use the same template with dynamic url from different controllers?
adminormoderator? Or at least the full url?@Controller @RequestMapping(value = "/admin") @PropertySource("classpath:application.properties") public class AdminController { //some other code @RequestMapping("/submit-murojaat") public String newMurojat(Model model) { model.addAttribute("caltest", new Caltest()); model.addAttribute("action", "/save-new-murojaat"); return "murojaatNewS"; } }