In a simple sample, I have two models DailyTimesheet
and MonthyTimesheet
:
class DailyTimesheet {
// other properties
MonthlyTimesheet timesheet;
}
class MonthlyTimesheet {}
In the form, I have the code as:
<form:form action="/update/timesheet" method="POST"
modelAttribute="dailyTimesheet">
<form:hidden id="timesheet_id" path="timesheet.id"/>
<!-- Other form stuff -->
</form:form>
In the controller, first I resolve the MonthlyTimesheet
instance by:
Long timesheetId = dailyTimesheet.getTimesheet().getId();
MonthlyTimesheet timesheet = MonthlyTimesheet.findTimesheet(timesheetId);
and then I do the rest for the business. In Firefox and Chrome, it works fine. However, in Internet Explorer, I get an NullPointerException
on dailyTimesheet.getTimesheet().getId()
that means the timesheet
instance for the dailyTimesheet
is null
. Looks strange as if the IE sends the data in a way that Spring MVC Binding does not bind the value to the related property.
Thanks for your help in advance.