0
<h:panelGrid columns="2">
                        <h:outputText value="Search Results List"/>
                        <p:commandButton value="Add user" process="@this" styleClass="btn-primary" style=" margin-bottom: 20px;margin-left: -80px;width:75px;" action="#{testBean.addUser(user)}"/>
                        <p:orderList styleClass="resultBox" style="color: #263F6A;" var="user" value="#{testBean.contacts}" 
                            itemLabel="#{user.firstName}"  itemValue="#{user.firstName}" controlsLocation="none">
                        </p:orderList>
                    </h:panelGrid>

我正在使用primefaces orderlist,我已经设法从后端获取orderlist,现在我已经从orderist中选择了一个项目并且必须将其发送到服务器端进行查询..我已经发布了上面的代码来做到这一点..我是由于用户对象为空而面临问题。如何从订单列表中发送选定的项目并通过服务器发送它也请解释一下 process="@this" 。我正在使用 primefaces 3.4.2 和 JSf2 websphere8。

提前致谢

4

2 回答 2

0

p:orderList 不是数据组件。您不能像那样将数据发送到后端。检查这个。尝试使用 dataTable 并在其中显示值。您可以将 f:setPropertyActionListener 用于 dataTable。

还要了解@this,请查看此链接

编辑:检查 primefaces展示以使用数据表传递数据,还有这个

于 2013-02-14T06:12:40.383 回答
0

请改用 selectOneListbox。唯一的区别是,您必须自己实现排序。

http://www.primefaces.org/showcase/ui/selectOneListbox.jsf

于 2013-08-09T12:59:38.813 回答