[英]Binding model to view with Spring Web Flow
我在绑定模型到表单视图时出现问题,即时通讯出现错误
Property or field 'city' cannot be found on null
我正在尝试将String place.location.city
绑定到我的视图
<form role="form" th:action="${flowExecutionUrl}" th:object="${place}" method="post">
<input class="form-control" th:field="*{location.city}"/>
<!-- ... -->
</form>
这是我收到错误的子流的xml
<view-state id="mapView" view="/places/add/location" model="place">
<transition on="locationSelected" to="locationReady"/>
</view-state>
<end-state id="locationReady">
</end-state>
错误消息告诉您Location或Place为空。
如果我不得不猜测您可能未在进入视图状态mapView 之前将模型Place放入流程xml中
<set name="flowScope.place" value ="new your.class.path.model.Place()"/>
虽然您可能想使用Factory方法来初始化Place(因此您也可以在1次调用中初始化Location)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.