【问题标题】:How does this selectItems field get saved into the database这个 selectItems 字段如何保存到数据库中
【发布时间】:2016-09-22 19:29:41
【问题描述】:
【问题讨论】:
标签:
oracle-adf
jdeveloper
【解决方案1】:
他只是在演示如何创建基于 bean 的 selectItems。当用户选择时,您需要在支持代码中捕获选择的索引:
<af:selectOneChoice label="Select Search" id="socSrch" autoSubmit="true" valueChangeListener="#pageFlowScope.wci.handleSelectSearch}" contentStyle="width:250px">
<f:selectItems id="si1" value="#{pageFlowScope.wci.searchNames}"/>
</af:selectOneChoice>
public void handleSelectSearch(ValueChangeEvent valueChangeEvent) {
if (valueChangeEvent.getNewValue() == null) {
return;
}
int selSearch = (Integer) valueChangeEvent.getNewValue();
//...now write this to DB via code handle to view and field if desired
}
此时,您可以决定是否要通过视图的支持 bean 代码句柄将所选项目的索引(值)写入数据库,或者您可以从支持中获取所选项目的标签带有一些进一步编码的选择项的 ArrayList,并将其填充到视图中,然后提交。该视图将有一个字段来接收您想要放入其中的内容。