【发布时间】:2013-04-29 22:21:03
【问题描述】:
如何使用当前的报价和 h:selectManyCheckBox 中的选定项目创建 ofer_has_location 对象(从位置和报价连接对象)
<h:selectOneMenu id="companyidCompany"
value="#{oferController.selected.companyidCompany}"
title="#{bundle.CreateOferTitle_companyidCompany}"
required="true"
requiredMessage="#{bundle.CreateOferRequiredMessage_companyidCompany}">
<f:ajax event="valueChange" execute="companyidCompany"
render="locationCollection" />
<f:selectItems value="#{companyController.itemsAvailableSelectOne}"/>
</h:selectOneMenu>
<h:outputLabel value="#{bundle.CreateOferLabel_locationCollection}"
for="locationCollection" />
<h:selectManyListbox id="locationCollection" value="locations"
title="#{bundle.CreateOferTitle_locationCollection}">
<c:forEach items="locations">
<f:selectItems var="locations"
value="#{oferController.selected.companyidCompany.locationCollection}" />
</c:forEach>
</h:selectManyListbox>
【问题讨论】:
-
没有理由使用
<c:forEach>。只需摆脱它,提供转换器,在列表框中使用正确的值绑定并在 AJAX 侦听器方法中准备必要的数据,就是这样。 -
@skuntsel,你需要打破所有这些
-
@kolossus 那么我将离开 OP 没有他的个人经验,这可能会对他编写现实世界应用程序的能力产生负面影响 :)
-
好的,我会为您提供一些指导。
-
给你!看看吧!