O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – passing data from the search users dialog to the source page

Let us add a new column Select to the DataTable in the searchUsers.xhtml page to select a user, and pass the selected user's details back to source page. Perform the following steps:

  1. Create a DataTable component with a Select column to choose a user row using the following code:
    <p:dataTable id="usersTbl" value="#{userController.searchUsers}" var="user">
      <p:column headerText="EmailId">
        #{user.emailId}
      </p:column>
      <p:column headerText="Name">
        #{user.firstName} #{user.lastName}
      </p:column>
      <p:column headerText="Select">
        <p:commandButton icon="ui-icon-search" actionListener="#{userController.selectSearchUser(user)}" />
      </p:column>
    </p:dataTable>
  2. When the user selects a row ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required