I have a p:selectOneMenu
and a p:commandButton
as shown in the code below :
<h:form styleClass="form-horizontal">
<div class="form-group ">
<div align="center">
<h:outputText for="dd" value="Unité organisationnelle" styleClass="col-lg-4 nomSalarie"/>
</div>
<div class="col-lg-6" align="center">
<p:selectOneMenu id="uniteOrga" value="#{resultatRecherche.uoRecherche}" >
<f:selectItem itemLabel="Choisir Unité Organisationnelle" itemValue="" noSelectionOption="true" />
<f:selectItems value="#{resultatRecherche.listeActivUo}" />
</p:selectOneMenu>
</div>
<div class="col-lg-2"></div>
</div>
<div class="form-group">
<div class="col-lg-4"></div>
<div align="center" >
<h:commandButton value="Rechercher" action="#{resultatRecherche.getCritere}" styleClass="col-lg-6 boutton"/>
</div>
<div class="col-lg-2"></div>
</div>
</h:form>
and here is the method getCritere
from my backing bean ResultatRecherche
:
public String getCritere () throws Exception
{
if ( isNullOrEmpty(prenomNomRecherche) && isNullOrEmpty(uoRecherche) )
{
return "pageRecherche";
}
else if ( !isNullOrEmpty(prenomNomRecherche) && isNullOrEmpty(uoRecherche) )
{
return getCollaborateursParNom();
}
//I am in these case
else if ( isNullOrEmpty(prenomNomRecherche) && !isNullOrEmpty(uoRecherche) )
{
return getCollaborateursParUo();
}
else
{
return getCollaborateurParNomEtUo();
}
}
My problem is that, when I select some items of my list (resultatRecherche.listeActiveUo
) and I click on the Rechercher
button, it works just fine (the result page is shown as expected), but when I select some other items from the list, the page remains as it is, and my p:selectOneMenu
is surrounded by red.
I used the debugger to see where the problem is, and I noticed that for the cases which are not working, the getCritere
method is not even reached.
Thanks for your help in advance.