I would like to call @RequestMapping(value = "", method = RequestMethod.DELETE)
in spring from thymeleaf form.
Is there any possibility to call delete or put request mapping methods from thymeleaf?
please give your suggestion on this.
The most important difference is reusability of back-end services. when you use thymeleaf, you are returning string fragments/pages into client side, while if you use angular, you can return objects (json response) into client side, so that can be used by different clients (web, mobile, etc).
Thymeleaf is way better in my opinion because it have good underlying priciples and exploits natural behaviour of browsers. Jsp makes html hard to read, it becomes weird mixture of html and java code which makes a lot of problems in comunication between designer - developer.
In some situations, you want a certain snippet of the Thymeleaf Template to appear in the result if a certain condition is evaluated as true. To do this you can use the attribute th:if. Note: In Thymeleaf, A variable or an expression is evaluated as false if its value is null, false, 0, "false", "off", "no".
Around the world in 2022, over 1859 companies have started using Thymeleaf as JavaScript MVC Framework tool.
You could use th:method
for this:
<form th:object="${commandObject}" th:action="@{/urlToCall}" th:method="delete">
This will generate a hidden input element, which will be picked up by Spring MVC:
<input type="hidden" name="_method" value="delete">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With