jsf - How do I pass a parameter to Primefaces menuitem that shows a dialog? -


i have p:menubutton contains several p:menuitems. each of these items has calls method parameter on session scoped backing bean , open modal dialog depends on backing bean. p:menuitem looks this:

<p:menuitem value="..." oncomplete="dialog.show()" update=":dialog" actionlistener="#{mycontroller.createnewitem}"> </p:menuitem> 

the parameter passed mycontroller.createnewitem thing depends on menuitem clicked , tried pass in 3 ways:

1) <f:setpropertyactionlistener target="#{mycontroller.newitem.property}" value="..." />

this doesn't work because modal dialog seems block f:setpropertyactionlistener. setter mycontroller.newitem.property gets called after close dialog, not enough. works if dialog not modal, need modal.

2) <f:attribute name="param" value="..." /> event.getcomponent().getattributes() returns map single element, looks some_namespace.mark_id => number, not parameter wanted pass.

3) <f:param name="param" value="..." /> read works action, not actionlistener, tried anyway. facescontext.getcurrentinstance().getexternalcontext().getrequestparametermap() contains fields on form parameters, not 1 wanted pass, guess doesn't work.

is there way i'm trying here or stuck using f:setpropertyactionlistener , non-modal dialog? thanks.

if want pass argumens , use action

<p:menuitem value="..." oncomplete="dialog.show()" update=":dialog" action="#{mycontroller.createnewitem(your parameter)}"> </p:menuitem> 

where createnewitem

public void createnewitem(.....){ } 

or

public string createnewitem(.....){       return null; } 

using action return null or void wont navigation...

about ajax request , <p:menuitem doing ajax implicitly under hood anyway


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -