jsf - Primefaces MenuItem actionListener not called -


i using jsf 2.2 , primefaces 4.0. want fire actionlistener when menuitem "usersettingmenuitem" called. problem listener method never called.

here menubar.xhtml:

<?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en"  "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"     xmlns:h="http://java.sun.com/jsf/html"     xmlns:ui="http://java.sun.com/jsf/facelets"     xmlns:f="http://java.sun.com/jsf/core"     xmlns:p="http://primefaces.org/ui"> <h:head> </h:head> <h:body>     <ui:composition>     <h:form>         <p:menubar styleclass="affaires"             style="position: absolute !important; bottom: 0px !important; vertical-align: bottom !important; list-style: none; width: 100%; text-align: center;">             <p:menuitem value="#{msg['navigation_home']}" url="home.xhtml" />              <p:menuitem value="companies" url="companies.xhtml" />              <p:menuitem id="messagenumber"                 value="#{taskboxmessagenumberbean.unseenmessages} #{msg['navigation_taskbox']}"                 url="taskbox.xhtml" />              <p:menuitem id="usersettingmenuitem"                         value="#{loginbean.user.user_name}"                         url="user-settings.xhtml"                         actionlistener="#{usersettingbean.onclicksettingsmenubar}"/>              <p:submenu label="#{msg['navigation_admin']}">                 <p:menuitem value="users" url="#" />                 <p:menuitem value="edit help" url="#" />                 <p:menuitem value="edit gtc" url="#" />             </p:submenu>              <p:menuitem value="#{msg['navigation_help']}" url="#" />          </p:menubar>     </h:form>     </ui:composition> </h:body> </html> 

and actionlistener method usersettingbean:

public void onclicksettingsmenubar(actionevent e){      log.info("onclicksettingsmenubar"); } 

you cannot have both url , actionlistener @ same time. use actionlistener , redirect users user-settings.xhtml @ end using like:

facescontext.getcurrentinstance().getexternalcontext().redirect("user-settings.xhtml"); 

Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -