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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:11:37+00:00 2026-05-15T10:11:37+00:00

in my ApplicationBean1.java class I have an Option[] attribute years and a filling method:

  • 0

in my ApplicationBean1.java class I have an Option[] attribute years and a filling method:

public void buildYearOptions(){
    int initialYear = 1900;
    int currentYear = Calendar.getInstance().get(Calendar.YEAR);
    int i = 0;
    for (int y = initialYear; y< currentYear; y++){
        Option op = new Option(y, Integer.toString(y));
        years[i] = op;
        i++;   
    }     
 }

And this is my jsp page using icefaces:

<ice:selectOneMenu id="selectOneYearMenu" partialSubmit="true"
    style="height: 24px; left: 238px; top: 94px; position: absolute; width: 72px;visibility: visible;"
    visible="true">
    <f:selectItems id="selectOneMenuYearItems" value="#{ApplicationBean1.years}"/>
</ice:selectOneMenu>

My problem is that the years from 1900 to currentyear(2010) are not showing up in the dropDownList (selectOneMenu).

Aan someone help me figure this out?

  • 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-15T10:11:38+00:00Added an answer on May 15, 2026 at 10:11 am

    I don’t do IceFaces, so it might do things differently I am not aware of, but you normally feed the f:selectItems with a SelectItem[], List<SelectItem> or a Map<Object, Object>, not with an Option[] or whatever type it is.

    This should work:

    private List<SelectItem> years; // +getter.
    
    public void buildYearOptions() {
        final int initialYear = 1900;
        final int currentYear = Calendar.getInstance().get(Calendar.YEAR);
        for (int year = initialYear; year < currentYear; year++) {
            years.add(new SelectItem(year, String.valueOf(year)));
        }     
    }
    

    If it still doesn’t give anything, then you’re likely calling buildYearOptions() at the wrong moment or probably not calling it at all.

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

Sidebar

Related Questions

I'm a undergrad Student at a German University. I have a team Programming Course
I have run into a pretty strange error that I can't get my head
I have an application scoped managed bean which main purpose is to serve the
Here's my page: <html xmlns=http://www.w3.org/1999/xhtml xmlns:h=http://java.sun.com/jsf/html xmlns:cpanel=http://java.sun.com/jsf/composite/components/cpanel xmlns:f=http://java.sun.com/jsf/core xmlns:p=http://primefaces.prime.com.tr/ui xmlns:ui=http://java.sun.com/jsf/facelets> <h:head> <title></title> </h:head> <h:body>
I'm trying to use hibernate to fill my jsf selectonemenu in ApplicationBean (in Liferay).
So, I've seen this post: JSF - session scoped bean shared by browsers on
I would like to display the currently running version of my web application in

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.