Note that there are some explanatory texts on larger screens.

plurals
  1. POJSF 2 Composite Component doesn't update value with f:ajax
    primarykey
    data
    text
    <p>I'm trying to implement a Composite Component in JSF 2, which will support the "change" ajax event. The CC is:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:composite="http://java.sun.com/jsf/composite"&gt; &lt;!-- INTERFACE --&gt; &lt;composite:interface name="inputText"&gt; &lt;composite:attribute name="label" /&gt; &lt;composite:attribute name="value" /&gt; &lt;composite:attribute name="disabled" default="false" /&gt; &lt;composite:attribute name="required" default="false" /&gt; &lt;composite:attribute name="rendered" default="true" /&gt; &lt;composite:clientBehavior name="change" event="change" targets="#{cc.clientId}:input" /&gt; &lt;/composite:interface&gt; &lt;!-- IMPLEMENTATION --&gt; &lt;composite:implementation&gt; &lt;h:panelGroup id="#{cc.clientId}" rendered="#{cc.attrs.rendered}"&gt; &lt;h:outputLabel value="#{cc.attrs.label}" for="input" /&gt; &lt;h:inputText id="input" label="#{cc.attrs.label}" value="#{cc.attrs.value}" disabled="#{cc.attrs.disabled}" required="#{cc.attrs.required}" /&gt; &lt;h:message for="input" /&gt; &lt;/h:panelGroup&gt; &lt;/composite:implementation&gt; &lt;/html&gt; </code></pre> <p><br/> Now, I'm trying to use it in the following form:</p> <pre><code>&lt;h:form id="form"&gt; &lt;input:inputText value="#{bean.value}" label="d1" id="d1"&gt; &lt;f:ajax event="change" update="@this,d2,d3" /&gt; &lt;/input:inputText&gt; &lt;h:inputText value="#{bean.value}" id="d2"&gt; &lt;f:ajax event="change" update="@this,d1,d3" /&gt; &lt;/h:inputText&gt; &lt;h:outputText id="d3" value="#{bean.value}" /&gt; &lt;/h:form&gt; </code></pre> <p>As far as I understand, if I change <strong>d1</strong>, d2 and d3 should display the value of d1, and if I change <strong>d2</strong>, both d1 and d3 should change accordingly as well.<br/> The problem is that when I change the value in <strong>d2</strong>, it only reflects in d3, while d1 stays blank, and when I change <strong>d2</strong>, d1 and d2 stays blank.<br/> <br/> I'm using Mojarra 2.0.2 (I couldn't manage to make 2.0.3 on Google App Engine, which is my AS). Do I miss something in the way composite components should be built? Or is it a bug in Mojarra 2.0.2? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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