jsf 2 - Dynamic ui include and commandButton -
i have page includes content page dynamically (this done method in bean)
firstpage.xhtml
<ui:include src="#{managedbean.pageview}"> <ui:param name="method" value="#{managedbean.someaction}"/> </ui:include>
this redirects secondpage within <ui:composition>
has commandbutton.
secondpage.xhtml
<ui:composition> .. .. <p:commandbutton actionlistener=#{method} value="submit"/> </ui:composition>
managedbean
public string pageview(){ homecoming "secondpage.xhtml"; } public void someaction(){ *someaction* }
the commandbutton in secondpage.xhtml not working.
any help shall much appreciated.
you can't pass method expressions via <ui:param>
. they're interpreted value expression.
you've 3 options:
split bean instance , method name on 2 parameters:
<ui:param name="bean" value="#{managedbean}" /> <ui:param name="method" value="someaction" />
and couple them in tag file using brace notation []
follows:
<p:commandbutton action="#{bean[method]}" value="submit" />
create tag handler converts value look method expression. jsf utility library omnifaces has <o:methodparam>
that. utilize follows in tag file:
<o:methodparam name="action" value="#{method}" /> <p:commandbutton action="#{action}" value="submit" />
use composite component instead. can utilize <cc:attribute method-signature>
define action methods attributes.
<cc:interface> <cc:attribute name="method" method-signature="void method()"/> </cc:interface> <cc:implementation> <p:commandbutton action="#{cc.attrs.method}" value="submit"/> </cc:implementation>
which used follows:
<my:button method="#{managedbean.someaction}" />
jsf-2 primefaces commandbutton uiinclude
No comments:
Post a Comment