I am having this issue where I am able to display a pagePage using Spring MVC Controller
@RequestMapping(value = "/example/user", method = RequestMethod.GET)
public ModelAndView showForm() {
System.out.println("#############Hellooo I was here#################");
return new ModelAndView("user", "user", new UserForm());
}
This is displaying a user.jspuser.jsp
as expected. Now from this User.JspUser.Jsp
I am submitting a form which is like this
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<html>
<head>
</head>
<body>
<h3>Welcome, Enter The Employee Details</h3>
<form:form method="POST" action="/example/userdetails" modelAttribute="user">
<table>
<tr>
<td><form:label path="firstName">Name</form:label></td>
<td><form:input path="firstName"/></td>
</tr>
<tr>
<td><form:label path="email">Email</form:label></td>
<td><form:input path="email"/></td>
</tr>
<tr>
<td><input type="submit" value="Submit"/></td>
</tr>
</table>
</form:form>
</body>
</html>
For some reason the control doesntdoesn't seem to be going to this method
` @RequestMapping(value = "/example/userdetails", method = RequestMethod.POST)
public String submit(@ModelAttribute("user")UserForm user,
BindingResult result, ModelMap model) {
System.out.println("#############Hellooo I was here ->submit#################");
if (result.hasErrors()) {
return "error";
}
model.addAttribute("firstName", user.getFirstName());
model.addAttribute("email", user.getEmail());
return "view";
}
Do with DXA/Tridion web app we need to do some settings to enable postPost
operations? As GetGet
seems to be working fine.