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

  • Home
  • SEARCH
  • 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 7001987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:52:20+00:00 2026-05-27T20:52:20+00:00

I want to display some data through primefaces datalist component. To achieve this I

  • 0

I want to display some data through primefaces datalist component. To achieve this I have an arrayList like ArrayList<Person>.

The person class looks something like this

class Person{
    private String name;
    private String age;
    private ArrayList<String> hobbies;
}

To display the data I’m using the following code:

<p:dataList value="{gameBean.persons}" var="person" itemType="disc">  
    Name: #{person.getName()}, Age: #{person.getAge()}, 
    <h:link value="Hobbies" onclick="dlg1.show();" />
</p:dataList>

What I want do do now, is to create a link that opens a dialog when clicked:

 <p:dialog header="Hobbies" widgetVar="dlg1" modal="true"height="100">
    //iterate through hobbies list to print it 
 </p:dialog>

So far this is working because I’ve hard coded the dialog as mentioned above in the xhtml file.

This method is of course not working for a dynamic amount of persons as I can not hard code the dialogs and the links. My question is, how can I create this dialogs programmatically and assign the right widgetVar variable to the onClick method of the Links?

Any help is highly apprechiated,
cheers Nikolaus

  • 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-05-27T20:52:21+00:00Added an answer on May 27, 2026 at 8:52 pm

    You can try this:

    <h:form id="form">
        <p:dataList value="{gameBean.persons}" var="person" itemType="disc">  
            Name: #{person.getName()}, Age: #{person.getAge()}, 
            <p:column>
                <p:commandLink value="Hobbies" actionListener="#{gameBean.onPersonSelect(person)}" 
                           oncomplete="dlg1.show();" update=":form:hobbiesDlg" />
            </p:column>
        </p:dataList>
    
        <p:dialog header="Hobbies" id="hobbiesDlg" widgetVar="dlg1" modal="true"height="100">
            //iterate through hobbies of gameBean.person to show here
        </p:dialog>
    </h:form>
    
    @ManagedBean
    @ViewScoped
    public class GameBean {
       private Person person;
    
       public void onPersonSelect(Person person) {
          this.person = person;
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JTable that I want to use to display some data (a
i have two foreach loop to display some data, but i want to use
I have a query which retrieves Some data. I want to display that data
I want to display and edit some objects in a WPF data grid and
i want to display some information in a listview using the GridView. i have
I have a .net (3.5) WinForms application and want to display some html on
I am looping through some forms and I want to display some of the
I want to display data in my own format from Mysql database connecting through
I have a list view that contains some data, I want to share it
I want to display some WPF elements near to the selected item of a

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.