Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Richfaces 3.2.0.GA and XHTML as mark up</p> <p>You can use javascript to call an a4j:js method, which inturn calls action method from managed bean. The param which you need to pass can be set to a hidden variable which when set will set the value to the java variable in your bean.</p> <pre><code>&lt;script&gt; function onButtonClick(){ $("#yourValue").val("value"); actionListenerMethod(); } &lt;/script&gt; &lt;a4j:jsFunction name="actionListenerMethod" actionListener="#{yourManagedBean.actionMethod}" oncomplete="scriptOnComplete();"&gt; &lt;/a4j:jsFunction&gt; &lt;h:inputHidden id="yourValue" value="#{yourManagedBean.yourValue}" /&gt; </code></pre> <p><strong>Managed bean:</strong></p> <pre><code>public void actionMethod(ActionEvent event){ if(yourValue == "something"){ /*your action goes here*/ } } </code></pre> <p>Otherwise you can by-pass this hidden variable by use of action param</p> <pre><code>&lt;script&gt; function onButtonClick(){ actionListenerMethod("value"); } &lt;/script&gt; &lt;a4j:jsFunction name="actionListenerMethod" actionListener="#{yourManagedBean.actionMethod}" oncomplete="scriptOnComplete();"&gt; &lt;a4j:actionparam name="param1" assignTo="#{yourManagedBean.yourValue}" /&gt; &lt;/a4j:jsFunction&gt; </code></pre> <p>In the later case the action param might get set only after the manged bean gets completed, in this case you can use Action atribute to call your action method instead of an action listener. This will help you to set the param and then call the action method.</p> <pre><code>&lt;a4j:jsFunction name="actionListenerMethod" action="#{yourManagedBean.actionMethod}" oncomplete="scriptOnComplete();"&gt; &lt;a4j:actionparam name="param1" assignTo="#{yourManagedBean.yourValue}" /&gt; &lt;/a4j:jsFunction&gt; </code></pre>
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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