Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8562409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:43:26+00:00 2026-06-11T16:43:26+00:00

I am having problems with displaying the selected item’s data on a dialogue using

  • 0

I am having problems with displaying the selected item’s data on a dialogue using Primefaces dialogue. setSelectedUsers method will fire but the dialogue won’t display the data of the user object. Any idea what I am missing here! I had a look at the primefaces showcase and I can’t see where I am doing wrong!

Primefaces 3.4, Mojarra 2.1, Java EE 6

I would appreciate any help. Thanks

<h:form prependId="false">
            <p:dataTable id="dataTable" var="user" value="#{userController.lazyModel}" styleClass="userDataTableStyle"
                    paginator="true" rows="10" selection="#{userController.selectedUsers}"
                    paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                    lazy="true" rowsPerPageTemplate="10,50,100,150">
            <f:facet name="header">
                User List
            </f:facet>
            <f:facet name="header">  
               Selection 
            </f:facet>  
            <p:column selectionMode="multiple" style="width:18px" />  
            <p:column>
                <f:facet name="header">
                    <h:outputText value="Username" />
                </f:facet>
                <p:commandLink value="#{user.username}" oncomplete="userDialog.show()"  title="View">
                    <f:setPropertyActionListener value="#{user}" target="#{userController.selectedUser}" />    
                </p:commandLink>
            </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="Firstname" />
                </f:facet>
                <h:outputText value="#{user.firstname}" />
            </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="Lastname" />
                </f:facet>
                <h:outputText value="#{user.lastname}" />
            </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="Email" />
                </f:facet>
                <h:outputText value="#{user.email}" />
            </p:column>
            <f:facet name="footer">
                <p:commandButton value="Create User" action="/admin/NewUser.xhtml?faces-redirect=true" ajax="false" icon="ui-icon-star"/>
                <p:commandButton value="Delete Users" actionListener="#{userController.doDeleteUsers}" update="dataTable" icon="ui-icon-trash"/>
            </f:facet>
        </p:dataTable>
        <p:dialog header="Car Detail" widgetVar="userDialog" resizable="false" id="userDlg" >  
            <h:panelGrid id="display" columns="2" cellpadding="4" style="margin:0 auto;">   
                <h:outputText value="Username" />  
                <h:outputText value="#{userController.selectedUser.username}" style="font-weight:bold"/>   
            </h:panelGrid>  
      </p:dialog> 
     </h:form>

Java code

@ManagedBean(name="userController")
@ViewScoped
public class UserController implements Serializable  {

        private @EJB UserEJB userEJB;     
        private User[] selectedUsers; 
        private List<User> lazyUserList;     
        private Address address = new Address();
        private User user = new User();
        private User selectedUser;
        private LazyDataModel<User> lazyModel; 

    public UserController() {
            lazyModel = new LazyUserDataModel(lazyUserList);
    }

        public String doNewUser() {
            return "admin/NewUser.xhtml?faces-redirect=true";
        }

        public String doCreateUser() {
            userEJB.persistUser(user);
            return "UserList.xhtml?faces-redirect=true";
        }

        public void doDeleteUsers(ActionEvent actionEvent){
            userEJB.deleteUsers(selectedUsers);
        }

        public User getSelectedUser() {  
            return selectedUser;  
        }  

        public void setSelectedUser(User selectedUser) {  
            this.selectedUser = selectedUser;  
        } 

        public User[] getSelectedUsers() {  
            return selectedUsers;  
        }  

        public void setSelectedUsers(User[] selectedUsers) {  
            this.selectedUsers = selectedUsers;  
        }  

        public void onRowSelect(ActionEvent event) {
            if(selectedUser == null)
                return;
            String userName = selectedUser.getUsername();
        }

        public Address getAddress() {
            return address;
        }

        public void setAddress(Address address) {
            this.address = address;
        }

        public User getUser() {
            return user;
        }

        public void setUser(User user) {
            this.user = user;
        }

    public List<User> getUsers() {
        return lazyUserList;
    }

        public LazyDataModel<User> getLazyModel() {
            return lazyModel;
        }        
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:43:27+00:00Added an answer on June 11, 2026 at 4:43 pm

    From the commandLink, you have to update the dialog content (update=”display”):

    <p:commandLink value="#{user.username}" update="display" oncomplete="userDialog.show()" title="View">
          <f:setPropertyActionListener value="#{user}" target="#{userController.selectedUser}" />    
    </p:commandLink>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using pyfacebook on my app but I'm having problems displaying xfbml For example
hey there, Im having problems displaying my results in this program but the program
I'm having some problems displaying a ProgressDialog. I have a method that scrapes information
I am having problems decoding UTF-8 strings in POST data when using the Node.JS
Im having problems with displaying ONLY some elements ONLY on print page. For example
I'm having problems properly displaying an alert in my Android app. The goal is
Hi I am having a problems displaying my array via JSON object. I passed
I'm having a problem displaying data from a function to text box within a
I am having problems with my sidebar_box , as it is displaying a unwanted
This maybe the reason why I'm having problems in other areas, but which outputting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.