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 8146147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:53:55+00:00 2026-06-06T13:53:55+00:00

I am using JSF 2.0 Mojarra. I need to create a Managed Bean that

  • 0

I am using JSF 2.0 Mojarra.

I need to create a Managed Bean that contains a property of type List. I need to initialize this list with some values in the Faces-Config.xml. My question is, what does the structure of my Class need to look like to accomplish this.

For example,

public class Items{
     private List<Item> itemList = new ArrayList<>();

     public List<Item> getItemList(){
     return itemList;
}

public void setItemList (List<Item> itemList){
     this.itemList = itemList;
}

//Methods needed for adding and removing type Item elements to/from itemList.
//What is the convention, so that JSF can initialize these values?

public class Item{
     //This is a nested class
     private String itemProperty1;
     private String itemProperty2;

     //Getters and Setters for itemProperty1 and itemProperty2 have been omitted
     //for brevity.
   }
}

Further, once I have my Class set up properly. What is the correct structure of the Faces-Config.xml. For example, should I do it like this:

 <managed-bean>
   <managed-bean-name>items</managed-bean-name>
   <managed-bean-class>com.bricks.model.Items</managed-bean-class>
   <managed-bean-scope>Application</managed-bean-scope>
   <managed-property>
     <property-name>itemList</property-name>
     <value-class>com.brick.model.Items.Item</value-class>
     <list-entries>
       <value>item1</value>
       <value>item2</value>
     </list-entries>
  </managed-property>
</managed-bean>

<managed-bean>
  <managed-bean-name>item1</managed-bean-name>
  <managed-bean-class>com.bricks.model.Item</managed-bean-class>
  <managed-bean-scope>None</managed-bean-scope>
  <managed-property>
    <property-name>itemProperty1</property-name>
    <value>value1</value>
  </managed-property>
  <managed-property>
    <property-name>itemProperty2</property-name>
    <value>value2</value>
  </managed-property>
</managed-bean>

 <!--Repeat for item2 -->

Thanks in advance for the help.

  • 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-06T13:53:58+00:00Added an answer on June 6, 2026 at 1:53 pm

    You’re referencing list items as plain vanilla strings.

    <value>item1</value>
    <value>item2</value>
    

    You need to reference them by EL so that it resolves to the managed Item instances.

    <value>#{item1}</value>
    <value>#{item2}</value>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using JSF (Mojarra 1.2) with Richfaces (3.3.2) within some facelets which are used
I'm using JSF 2.0 with GlassFish 3.0. I have the following Managed Bean: @ManagedBean
I'm using JSF 2 and I need c:foreach in some purposes. But no matter
I am using JSF 2.0 btw I have an attribute X type Integer, that
I am using JSF-Spring integration, I am calling a Spring-managed request scoped bean method
I am using Mojarra 2.0.4 implementation of JSF with Tomcat server for one of
I am using JSF validation to simply check that the length of a field
My product is using JSF with Primefaces 2.2. What I need is to process
I am writing a web application using JSF 2. I have downloaded mojarra-2.1.3-FCS-binary.zip and
I'm using JBoss6.1.Final, JSF 2.0 (Mojarra), Weld CDI, MyFaces CODI 1.0.5 (for view-access-scoped) I'm

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.