Thanks a lot Hetal.
How about doing the conversion from a JODA LocalDate to the form and back?
When I create the Object used as command,
Code:
class Param {
@NotNull
private LocalDate date;
...}
Controller
Code:
...
model.addAttribute("param", new Param(date));
Code:
<sf:form action="adjust.html" method="post"
commandName="param">
<sf:input path="date" id="date" />
...
</sf:form>
It gets displayed as 14/01/2010 which is ok, although a bit weird since the toString() on a LocalDate does yyyy-mm-dd.
But on the handler of adjust command, the object has a NULL date!
Code:
@RequestMapping(value = "/adjust", method = RequestMethod.POST)
public String adjust(@Valid @ModelAttribute("param") final WebSwapProxyDelta parameter, final BindingResult result) {
parameter.getDate() is null!
Questions:
1/ why is null? Surely I'm missing a conversion somewhere...
2/ How come it was not validated (I have Hibernate Validator in the classpath)
A pointer to an article / blog / end-to-end example with date/joda conversion would be great
Many thanks
B