0

hi i have a question i have a selectOneMenu and depending on the value chosen i display my datatable but i want when i open my jsf page at first to display all the rows and also if i choose everything in the selectOneMenu to display all the rows. how i could do that.

JSF :

 <h:panelGrid columns="2" cellpadding="5">
       <h:outputText value="Annee : " style="font-size: 18px" />
       <p:selectOneMenu value="#{anneeBean.annee}"  >
       <f:selectItem itemValue="#{null}" itemLabel="--Séléctionner une année--" />
       <f:selectItems value="#{anneeBean.listeAnnees}" var="annee" 
                      itemValue="#{annee}" itemLabel="#{annee}" />
      <f:ajax listener="#{anneeBean.submit()}" render="display" />
    </p:selectOneMenu>
       </h:panelGrid>

Hibernate

@Override
    public List getAllBudgets(Integer id) {
        Session session=HibernateUtil.getSession();
        try
        {
            session.beginTransaction();
            Query q = session.createQuery("from Budgetisation as b left join fetch b.rubrique as r left join fetch b.annee where b.id.annee=:annee");
            q.setParameter("annee", id);
            listeBudgets = q.list();
            return listeBudgets;
        }
        catch(HibernateException e)
        {
            throw e;
        }
        finally
        {
            session.close();
        }
    }
Marina
  • 71
  • 2
  • 15
  • 1
    Select everything from selectOneMenu? Impossiboo – Josef E. Jun 18 '14 at 16:13
  • It's called a **`selectOneMenu`** for a reason (*one* being the keyword there). If you need to select more than one, use the `selectManyMenu` – kolossus Jun 18 '14 at 19:43
  • it's not that i need to select more than one on the select one menu.what i need, is for example, if i have an id : 1,2,3. i could choose 1, 2 or 3 . but i want to add an item named everything that does the sql select * from table or select * from table where column = everything @kolossus – Marina Jun 19 '14 at 11:31

0 Answers0