Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Take a closer look to the primefaces showcase : <a href="http://www.primefaces.org/showcase/ui/picklist.jsf" rel="nofollow">Primefaces picklist</a></p> <p>Call the <code>dualListVars</code> directly. <code>#{reportConfiguratorBean.dualListVars}</code> is resolved to <code>reportConfiguratorBean.getDualListVars()</code> since dualListVars is a property (eg. a property with a getter and a setter).</p> <pre><code>&lt;p:pickList id="pickList" value="#{reportConfiguratorBean.dualListVars}" var="cRVariable" itemValue="#{cRVariable}" itemLabel="#{cRVariable.varName}" converter="#{cRImageTypeConverter}" immediate="true" rendered="true" &gt; &lt;f:facet name="sourceCaption"&gt;Available Variables&lt;/f:facet&gt; &lt;f:facet name="targetCaption"&gt;Associated Variables&lt;/f:facet&gt; &lt;/p:pickList&gt; </code></pre> <p>The action attribute is meant for business logic. You can catch here the source and target list. The process attribute tell JSF which components to process. In your case, you want the component <code>picklist</code> and <code>commandButton</code> to be processed. You can also process the whole form with <code>process="@form"</code>.</p> <pre><code>&lt;p:commandButton id='varassociate' action="#{reportConfiguratorBean.readMyAssocImTypVariables}" value='Associate' ajax='false' process="@this,pickList" immediate="true" /&gt; </code></pre> <p>The readMyAssocImTypVariables function :</p> <pre><code> public void readMyAssocImTypVariables() { List&lt;CRVariable&gt; sourceVariables = this.dualListVars.getSource(); List&lt;CRVariable&gt; targetVariables = this.dualListVars.getTarget(); for (CRVariable sourceVariable:sourceVariables) { System.out.println("&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; I am a source variable: " + sourceVariable.getVarName()); } for (CRVariable targetVariable:targetVariables) { System.out.println("&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; I am a target variable: " + targetVariable.getVarName()); } } </code></pre> <p><strong>Unrelated</strong> : Do NOT put business logic into getters/setters ! They are called multiple time by JSF.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload