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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:27:39+00:00 2026-06-13T06:27:39+00:00

I am working on a project and I am not too familiar with JSF

  • 0

I am working on a project and I am not too familiar with JSF so please correct any gaps in this question.

I have a property file that holds the value of the domain…so for example

domain=.com
domain=.net

In my Bean I have this

private String domain;
private String[] domainSelection;

public void initProp(){

   try {
      Configuration config = new PropertiesConfiguration("prop.properties");
      domainSelection = config.getStringArray("domain");

   } catch (ConfigurationException e) {
      Log.error("Error");
   }

}

In the .jsp page with the JSF I have

<rich:select id="domain" value="#{Bean.domain}"                                               
      required="true">
     <f:selectItems itemValue="#{Bean.domainSelection}" />
</rich:select>

When I debug this, I get two value in domainSelection but I need to get them over to the JSF and I can’t figure out how to do that.

  • 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-13T06:27:41+00:00Added an answer on June 13, 2026 at 6:27 am

    Sorry for the initial answer I missed the question completely.

    private List<SelectItem> domains = new ArrayList<SelectItem>();
    //for each domain
    domains.add("com",firstFromDomainSelection);
    domains.add("net",secondFromDomainSelection);
    
    <f:selectItems value="#{Bean.domains}" />
    

    So this requires getDomains to retrieve them.

    Edit:

    It is doable I believe as long as you read the properties file again. one thing to keep in mind is that file might be in a .war already, so you are going to have to figure a way to re-add or just add it to the deployed folder.

    Everytime the view wants to get the list it will call getDomains() that means we should have the logic there to pull the propetries evertime it is called. Might be a slight performance hit because of File IO.

    private List<SelectItem> domains;
    private Configuration config = new PropertiesConfiguration("prop.properties"); // with accessors
    
    public List<SelectItem> getDomains(){
      domains = new ArrayList<SelectItem>();
      String[]  domainSelection = getConfig().getStringArray("domain");
      for(String domain : domainSelection ){
         //Define desired logic for the value if its the same (.com) pass the same as value
         domains.add( new SelectItem(domain ,domain)); // SelectItem(value, label);
      }
      return domains;
    }
    

    What I would do

    Instead of using the properties file I would use a table for the domains and just dynamically add those records to the table and they will be retrieved accordingly. When there are many requests on that view it will probably slow things down– at least slightly. The other issue to keep in mind is if apache caches those files. Just keep that in mind. Using a db table is safer IMO.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not too familiar with ExtJS, but am working on a project that uses
I'm working on a security project in Javascript (something I honestly have not used),
Possible Duplicate: cmake is not working in opencv c++ project I have a huge
I'm working with a Ruby project for school, and have sadly not been able
I've got some syntax in a project I'm working on that I'm not familiar
I am working through the problems on project Euler and am not too certain
I have been working on one project which is too complex and contain very
Suppose you're working on a project and the time/money budget does not allow 100%
I am currently working on a school project and I'm not sure what is
I've a project that I'm working on which has not been started by me.

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.