用嵌套对象填充Java表单

用嵌套对象填充Java表单,java,playframework-2.0,Java,Playframework 2.0,我正在做一个有webservice服务器和Play的项目!2.0作为webapp。两者都与POJO模型共享一个JAR文件。没有JPA,没有其他关系。我只是把它们映射到Mongo对象。 所有字段都是公共字段,toString上只有重载,以便于调试 现在,我想用从webservice加载的对象填充正在使用的表单 Dispatch preDispatch= patientCardsService.getGetDispatch(name, surname, null); Form<Dispatch

我正在做一个有webservice服务器和Play的项目!2.0作为webapp。两者都与POJO模型共享一个JAR文件。没有JPA,没有其他关系。我只是把它们映射到Mongo对象。 所有字段都是公共字段,toString上只有重载,以便于调试

现在,我想用从webservice加载的对象填充正在使用的表单

Dispatch preDispatch= patientCardsService.getGetDispatch(name, surname, null);
Form<Dispatch> dispatchForm = form(Dispatch.class).fill(preDispatch);
return ok(patientCard.render(dispatchForm ));
当然,Dispatch对象包含PatientData对象,该对象包含名称和姓氏字符串。 jqmInput是一个助手

@(field: Field, label: String, fieldType: Symbol = 'text)
<div data-role="fieldcontain" class="ui-field-contain ui-body ui-br">
    <label for="@field.id" class="ui-input-text" class="ui-input-text">@label</label>
    <input type="@fieldType.name" value="@field.value" name="@field.id" class="ui-input-text ui-body-c ui-corner-all ui-shadow-inset"/>
</div>
而这并没有填充对象。 我已经检查并填充了填充之前的对象


有人知道这是什么原因吗?

Scala可以使用嵌套形式。使用Java,这似乎也是可能的:而且
@(field: Field, label: String, fieldType: Symbol = 'text)
<div data-role="fieldcontain" class="ui-field-contain ui-body ui-br">
    <label for="@field.id" class="ui-input-text" class="ui-input-text">@label</label>
    <input type="@fieldType.name" value="@field.value" name="@field.id" class="ui-input-text ui-body-c ui-corner-all ui-shadow-inset"/>
</div>