0 Replies Latest reply on Apr 25, 2006 8:15 AM by blalls asdsd

    @Factory problem

    blalls asdsd Novice

      I am trying to use this code on my page:
      <h:selectOneMenu id="template" value="#{neBean.template}">
      <f:selectItems value="#{templateMap}"/>
      </h:selectOneMenu>

      The template map coming from TemplaeLogic with this method:
      @Factory("templateMap")
      public Map<String,Long> getTemplateMap(){
      System.out.println("getting the template map");
      Map<String,Long> m = new HashMap();
      Listtps= entityManager.createQuery(" from Template order by name").getResultList();
      for(Template t : tps) {
      m.put(t.getName(),t.getId());
      }
      System.out.println("map created count is " + m.size());
      return m;
      }
      Strangely rendering the page gives me an error message wich says the templateMap is null and after that the log messages of factory method apears! I mean it tries to render the page and after that calling the method to create the templateMap. I wonder why it is happening in this way.