我正在尝试使用带有RichFaces suggestionBox组件的SelectItems列表。问题是我需要存储id而不是SelectItem的标签。似乎suggestionBox总是存储标签,这导致了一个问题。有没有办法解决这个问题?
发布于 2009-11-06 19:32:28
我使用的是这样的东西:
<h:inputText
id="suggest"
value="#{someBean.someStringValue}"
converter="#{myStringValueConverter}">
<a:support event="onblur" ajaxSingle="true"/>
</h:inputText>
<rich:suggestionbox for="suggest"
suggestionAction="#{suggestionInstance.suggestion}"
var="s"
fetchValue="#{s.someValue}"
ajaxSingle="true">
<h:column>
<h:outputText value="#{s.anotherValue}"/>
</h:column>
<h:column>
<h:outputText value="#{s.yetAnotherValue}"/>
</h:column>
<a:support event="onselect" ajaxSingle="true" reRender="target">
<f:setPropertyActionListener value="#{s}" target="#{someBean.someObject}" />
</a:support>
</rich:suggestionbox>setPropertyActionListener可以完成您正在寻找的工作。我的输入文本也有一个转换器,这样用户就可以输入一些东西(在我的实例中是UN位置代码),我可以尝试在转换器中将其解析为一个对象。
https://stackoverflow.com/questions/1681559
复制相似问题