spring - How to do request mapping with form action? -
i want map form action controller class mapping doesn't found action.
it's quite general question. in general, have controller class (which mapped in configuration file) listens urls. example
@controller public class commoncontroller { @requestmapping(value="/index", method=requestmethod.post) public string loginform(@modelattribute @valid user user, bindingresult results) { return "index"; } }
in page containing form, set form action /index
. example, if use thymeleaf
<form method="post" th:action="@{/index.html}" th:object="${user}"> ... </form>
for more information, read spring guide.
Comments
Post a Comment