Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your question is not very specific. But as far I understand, you basically want to submit the entire form and reload the entire page (why not just the form?). </p> <p>In that case, you need to set the <code>execute</code> attribute to <code>@form</code> so that the entire form will be submitted (it namely defaults to <code>@this</code>, the current component) and you also need to set the <code>render</code> attribute to <code>@all</code> so that the entire view will be re-rendered (or use <code>@form</code> instead if just re-rendering the form is sufficient).</p> <pre><code>&lt;h:selectBooleanCheckbox value="#{listModel.creationDate.range}"&gt; &lt;f:ajax event="click" execute="@form" render="@all" /&gt; &lt;/h:selectBooleanCheckbox&gt; </code></pre> <p>The <code>event="click"</code> is by the way optional in the above construct. It's already the default ajax event for a <code>&lt;h:selectBooleanCheckbox&gt;</code>. You can just leave it away:</p> <pre><code>&lt;h:selectBooleanCheckbox value="#{listModel.creationDate.range}"&gt; &lt;f:ajax execute="@form" render="@all" /&gt; &lt;/h:selectBooleanCheckbox&gt; </code></pre> <p>Also, your <code>action</code> attribute is not valid. It does not exist. If you actually want to invoke a method during invoke actions phase, then you need the <code>listener</code> attribute instead.</p> <pre><code>&lt;h:selectBooleanCheckbox value="#{listModel.creationDate.range}"&gt; &lt;f:ajax execute="@form" listener="#{listModel.rangeListener}" render="@all" /&gt; &lt;/h:selectBooleanCheckbox&gt; </code></pre> <p>with</p> <pre><code>public void rangeListener() { // ... } </code></pre> <p>or, optionally, if you need to be able to <a href="http://docs.oracle.com/javaee/6/api/javax/faces/event/AjaxBehaviorEvent.html" rel="nofollow noreferrer">broadcast events</a>:</p> <pre><code>public void rangeListener(AjaxBehaviorEvent event) { // ... } </code></pre> <p>The syntax is the same for <code>&lt;a4j:ajax&gt;</code>. The only difference is that it resolves <code>execute</code> and <code>render</code> a bit differently and supports more convenient attributes.</p> <h3>See also:</h3> <ul> <li><a href="http://download.oracle.com/javaee/6/javaserverfaces/2.1/docs/vdldocs/facelets/f/ajax.html" rel="nofollow noreferrer"><code>&lt;f:ajax&gt;</code> VDL documentation</a></li> <li><a href="http://docs.jboss.org/richfaces/latest_4_0_X/vdldoc/a4j/ajax.html" rel="nofollow noreferrer"><code>&lt;a4j:ajax&gt;</code> VDL documentation</a></li> <li><a href="https://stackoverflow.com/questions/7590361/is-there-any-difference-between-fajax-and-a4jajax">Is there any difference between f:ajax and a4j:ajax?</a></li> </ul>
 

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