あなたの状況を再現することはできません。より多くのコードを提供できますか? 私の例は間違った入力を示しています:
public class Person {
private Date birthDay;
public void setBirthDay(Date birthDay) {
this.birthDay = birthDay;
}
public Date getBirthDay() {
return birthDay;
}
}
コントローラ:
@Controller
@RequestMapping("/person")
public class PersonController {
@RequestMapping(value ="/edit", method=RequestMethod.GET)
public String edit(Person person, BindingResult result){
return "person/edit";
}
@RequestMapping(value ="/edit", method=RequestMethod.POST)
public String submit(Person person, BindingResult result){
if(result.hasErrors()){
return "person/edit";
} else {
return "redirect:person/edit.ss";
}
}
Jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<form:form method="POST" modelAttribute="person">
Birth day: <form:input path="birthDay" /><form:errors path="birthDay" />
<br />
<input type="submit" value="Submit" />
</form:form>