user3070142
user3070142

Reputation: 59

Button not working

I m using Jsf2 and Primefaces 3.5 ,this is my page header.inc.xhtml ,it s a modal dialog contient 2 buttons :

header.xhtml

 </h:head>
 <h:body>  
 <p:dialog id="modalDialog" widgetVar="dlg2" modal="true"    height="100" visible="true">  
 <h:panelGrid columns="2" cellpadding="5">
Nom :<font style="color: red">*</font>
<p:inputText  id="Nom" name="Nom" type="text"/>
<label  id="ErrorMessageLabel" style="color: red;display: none;">Champ obligatoire</label>
    <p:commandButton value="Recherche" type="button" icon="ui-icon-check" action ="#{collList.redirectToFiltrePage}"/>  
    <p:commandButton value="Annuler" type="button"  icon="ui-icon-close" onclick="dlg2.hide();" />       
    </h:panelGrid>
</p:dialog>
</h:body> 
</ui:composition>  

CollBean.java

@ManagedBean(name="collist")
@SessionScoped
public class CollBean implements CollListBean {
.
.
.
public void redirectToFiltrePage() {        
    try {
    System.out.println("ça marche");
    } catch (Exception e) {
        e.printStackTrace();
    }   
}
}

Can someone help me plz, this button "Recherche" not working, have a nice day :) :)

Upvotes: 0

Views: 172

Answers (1)

Andre
Andre

Reputation: 3904

You're missing the #{} around the method. And I'd use an actionListener since your method is void. It should be like this:

    <p:commandButton value="Recherche" type="button" icon="ui-icon-check" actionListener ="#{collaboratorList.redirectToFiltrePage}" />  

Upvotes: 1

Related Questions