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>

I was working with primefaces orderlist, I have managed to get orderlist from backend, now I have select one of item from orderist and have to send it to server side to query.. I have posted the above code to do that.. I am facing problems as user object is null.. How to send an selected item from orderlist and send it across the server also please explain me about the process="@this" . I am using primefaces 3.4.2 and JSf2 websphere8.

Thanks in advance

shreekanth
  • 459
  • 2
  • 12
  • 27

2 Answers2

0

p:orderList is not a data component. You cannot send data to the backend like that. Check this. Try using dataTable and displaying value in it. You can use f:setPropertyActionListener for dataTable.

Also to know about @this check this link

Edit: Check primefaces showcase to pass the data using datatable and also this

Community
  • 1
  • 1
h-kach
  • 351
  • 2
  • 8
  • 25
  • Ya I agree with you @hemanth , I removed the orderList and used data table now, but selected object of data table is going null.. SelectEvent event, here event is coming but event.getObject is throwing Null pointer exception.. I have also used the selection attribute of data Table, what am I doing wrong? – shreekanth Feb 14 '13 at 08:52
  • Did you use f:setPropertyActionListener to set the data? or you can use "selection" attribute of the p:dataTable. See the demo link I have given. If it doesn't work post your code here – h-kach Feb 14 '13 at 10:05
  • I solved the problem, I did not added the row key attribute in Data table. – shreekanth Feb 15 '13 at 08:42
0

Use selectOneListbox instead. The only difference is, that you have to implement the ordering by yourself.

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

tvetsch
  • 1
  • 2