jsf - selectManyMenu selection values inside a composite -


i've created composite contains primefaces selectmanymenu. i'm attempting pass bound selection value composite, fails.

composite code:

<html xmlns="http://www.w3.org/1999/xhtml"       xmlns:ui="http://java.sun.com/jsf/facelets"       xmlns:composite="http://java.sun.com/jsf/composite"       xmlns:h="http://java.sun.com/jsf/html"       xmlns:f="http://java.sun.com/jsf/core"       xmlns:p="http://primefaces.org/ui"       xmlns:kf="http://java.sun.com/jsf/composite/kf"       xmlns:c="http://java.sun.com/jsp/jstl/core">  <composite:interface>     <composite:attribute name="selectedusers" required="true"/>     <composite:attribute name="users" required="true" type="java.util.list"/>     <composite:attribute name="recommendactionhandler" required="true" method-signature="void listener()"/>     <composite:attribute name="recommendbuttonstyle"/>     <composite:clientbehavior name="click" event="change" targets="recommendusers" default="true"/> </composite:interface>  <composite:implementation>     <div id="#{cc.clientid}">         <h:form id="recommendform" prependid="false">             <p:growl id="recommendgrowl" showdetail="true"/>              <p:commandbutton id="recommendbtn" value="recommend" type="button" update=":recommendform,recommendusers" style="#{cc.attrs.recommendbuttonstyle}"/>             <p:overlaypanel id="recommendpanel" for="recommendbtn" widgetvar="recommendpanel"                     dynamic="true"                     hideeffect="fade"                      showcloseicon="true">                 <p:selectmanymenu id="recommendusers" value="#{cc.attrs.selectedusers}" showcheckbox="true"                         style="width:150px;height:200px">                     <f:selectitems value="#{cc.attrs.users}" var="user" itemlabel="#{user.login}" itemvalue="#{user.login}"/>                 </p:selectmanymenu>                 <p:commandbutton id="submitrecommendations"                         value="send"                         update="recommendusers recommendgrowl"                         actionlistener="#{cc.attrs.recommendactionhandler}"                         process="recommendusers @this"                         />             </p:overlaypanel>         </h:form>     </div> </composite:implementation> </html> 

view code:

<html xmlns="http://www.w3.org/1999/xhtml"       xmlns:ui="http://java.sun.com/jsf/facelets"     xmlns:h="http://java.sun.com/jsf/html"     xmlns:f="http://java.sun.com/jsf/core"     xmlns:p="http://primefaces.org/ui"     xmlns:kf="http://java.sun.com/jsf/composite/kf"     >      <ui:composition template="/web-inf/facelet_templates/default.xhtml">         <ui:define name="content">             <kf:recommend id="recommendit"                  selectedusers="#{recommendviewbean.selectedusers}"                 users="#{recommendviewbean.users}"                 recommendactionhandler="#{recommendcontroller.saverecommendations()}"                 />         </ui:define>     </ui:composition>   </html> 

view bean code:

public class recommendviewbean {       private list<usertype> users = new arraylist<usertype>();     private list<string> selectedusers = new arraylist<string>();      //setters , getters... } 

in code above, value selectedusers value in question. pass view/backing bean's list value holds selections selectmanymenu's value attribute. works great when outside of composite or if pass view bean this...

<html xmlns="http://www.w3.org/1999/xhtml"       xmlns:ui="http://java.sun.com/jsf/facelets"     xmlns:h="http://java.sun.com/jsf/html"     xmlns:f="http://java.sun.com/jsf/core"     xmlns:p="http://primefaces.org/ui"     xmlns:kf="http://java.sun.com/jsf/composite/kf"     >      <ui:composition template="/web-inf/facelet_templates/default.xhtml">         <ui:define name="content">             <kf:recommend id="recommendit"                  selectedusers="#{recommendviewbean}"                 users="#{recommendviewbean.users}"                 recommendactionhandler="#{recommendcontroller.saverecommendations()}"                 />         </ui:define>     </ui:composition>   </html> 

...

<html xmlns="http://www.w3.org/1999/xhtml"       xmlns:ui="http://java.sun.com/jsf/facelets"       xmlns:composite="http://java.sun.com/jsf/composite"       xmlns:h="http://java.sun.com/jsf/html"       xmlns:f="http://java.sun.com/jsf/core"       xmlns:p="http://primefaces.org/ui"       xmlns:kf="http://java.sun.com/jsf/composite/kf"       xmlns:c="http://java.sun.com/jsp/jstl/core">  <composite:interface>     <composite:attribute name="selectedusers" required="true"/>     <composite:attribute name="users" required="true" type="java.util.list"/>     <composite:attribute name="recommendactionhandler" required="true" method-signature="void listener()"/>     <composite:attribute name="recommendbuttonstyle"/>     <composite:clientbehavior name="click" event="change" targets="recommendusers" default="true"/> </composite:interface>      <composite:implementation>         <div id="#{cc.clientid}">             <h:form id="recommendform" prependid="false">                 <p:growl id="recommendgrowl" showdetail="true"/>                  <p:commandbutton id="recommendbtn" value="recommend" type="button" update=":recommendform,recommendusers" style="#{cc.attrs.recommendbuttonstyle}"/>                 <p:overlaypanel id="recommendpanel" for="recommendbtn" widgetvar="recommendpanel"                         dynamic="true"                         hideeffect="fade"                          showcloseicon="true">                     <p:selectmanymenu id="recommendusers" value="#{cc.attrs.selectedusers.selectedusers}" showcheckbox="true"                             style="width:150px;height:200px">                         <f:selectitems value="#{cc.attrs.users}" var="user" itemlabel="#{user.login}" itemvalue="#{user.login}"/>                     </p:selectmanymenu>                     <p:commandbutton id="submitrecommendations"                             value="send"                             update="recommendusers recommendgrowl"                             actionlistener="#{cc.attrs.recommendactionhandler}"                             process="recommendusers @this"                             />                 </p:overlaypanel>             </h:form>         </div>     </composite:implementation>     </html> 

so, question is, how pass appropriate bound value selectmanymenu's value attribute composite?

thanks much. let me know if need explain more.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

mysql - Pass value between different pages (form) with PHP -