I have a ToolBar which contain a number of button. these button must be a link to other xhtml pages. But they don’t work. This is my code :
<h:form>
<p:toolbar>
<p:toolbarGroup align="left">
<p:commandButton id="btn1" type="button" action="faces/Genseignant" value="Gestion Enseignants" icon="ui-icon-folder-open" />
<p:commandButton id="btn2" type="button" action="Gclasse" value="Gestion Classes" icon="ui-icon-folder-open" />
<p:commandButton id="btn3" type="button" action="Getudiant" value="Gestion Etudiants" icon="ui-icon-folder-open" />
<p:commandButton id="btn4" type="button" action="Gmatiere" value="Gestion Matières" icon="ui-icon-folder-open" />
<p:commandButton id="btn5" type="button" action="Gsalle" value="Gestion Salles" icon="ui-icon-folder-open" />
<p:commandButton id="btn6" type="button" value="Gestion Horaires" icon="ui-icon-folder-open" />
<p:separator />
</p:toolbarGroup>
<p:toolbarGroup align="right">
<p:menuButton value="Options">
<p:menuitem value="Acceuil" action="Genseignant"/>
<p:menuitem value="Déconnectté(e)" />
</p:menuButton>
</p:toolbarGroup>
</p:toolbar>
</h:form>
When I try this with a MenuBar, It works properly.
Any suggetions please .
Remove the
type="button"attribute. Otherwise commandButtons cannot be used this way.The difference is evident from the browser source:
This is the button with
type="button":This is the button without
type="button"which defaults totype="submit":