1 Reply Latest reply on Mar 31, 2009 2:02 PM by Jay Balunas

    select list updating on every call

    Waqas Arshad Novice

      Look at the following code:

      public class User {
       private String name;
       private List<SelectItem> temp_list;
      ...setter, getter
       public User() {
       if(this.getName() == null) {
       public void populate() {
       temp_list = new ArrayList<SelectItem>();
       temp_list.add(new SelectItem("Sunday"));
       temp_list.add(new SelectItem("Monday"));
       temp_list.add(new SelectItem("Tuesday"));

      <a4j:region selfRendered="true" id="text">
       <h:selectOneMenu id="symbol" value="#{user.name}">
       <f:selectItems value="#{user.temp_list}" />
       <a4j:commandButton action="#{user.getData}" value="Get"/>

      Now whenever i press the button, populate() call again and list is populated with all three values again. I want to put the restriction that populate() should be call only once when the page loads.
      Any suggestions.