2 Replies Latest reply on Nov 11, 2005 6:13 AM by Martin Henderson

    JSF - SelectItem list

    Martin Henderson Newbie

      Hi folks,
      Looking for some help.

      I have a selectManyListBox that I'm trying to populate from a function :

       public List getAgentItems()
       {
       Query query = propertyDatabase.createQuery("from Agent");
       List<Agent> agents = query.list();
       agentItems = new ArrayList();
       for (Agent agent : agents)
       {
       agentItems.add(new SelectItem(agent.getName()));
       }
       return this.agentItems;
       }
      
       public String[] getAgents()
       {
       return searchAgents;
       }
      
       public void setAgents(String[] agents)
       {
       this.searchAgents = agents;
       }
      
       @In(create=true)
       private Session propertyDatabase;
      
       @Out(required=false)
       private List<SelectItem> agentItems = null;
      
      

      however each time the function gets called the session is null.... it just doesn't seem to be getting created in time for the function call.
      the jsf looks like:
       <h:selectManyListbox value="#{propertySearch.agents}">
       <f:selectItems value="#{propertySearch.agentItems}"/>
       </h:selectManyListbox>
      


      hope someone can point me in the right direction.... thanks!