You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2014/02/06 01:31:12 UTC
svn commit: r1565022 -
/myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-core-concepts/how-the-immediate-attribute-works.mdtext
Author: lu4242
Date: Thu Feb 6 00:31:12 2014
New Revision: 1565022
URL: http://svn.apache.org/r1565022
Log:
test how to fix documentation
Modified:
myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-core-concepts/how-the-immediate-attribute-works.mdtext
Modified: myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-core-concepts/how-the-immediate-attribute-works.mdtext
URL: http://svn.apache.org/viewvc/myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-core-concepts/how-the-immediate-attribute-works.mdtext?rev=1565022&r1=1565021&r2=1565022&view=diff
==============================================================================
--- myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-core-concepts/how-the-immediate-attribute-works.mdtext (original)
+++ myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-core-concepts/how-the-immediate-attribute-works.mdtext Thu Feb 6 00:31:12 2014
@@ -94,11 +94,8 @@ validation errors occurred).</li>
<p>For an action listener method that returns void, it is necessary to call
</p>
-<ac:macro
-ac:name="code"><ac:default-parameter>java</ac:default-parameter><ac:plain-text-body><![CDATA[
- facesContext.renderResponse();
-]
-]></ac:plain-text-body></ac:macro>
+ :::java
+ facesContext.renderResponse();
<p>if the normal flow is not desired.</p>
@@ -155,28 +152,22 @@ input component that the associated acti
<li>add a valueChangeListener attribute</li>
</ul>
-
-<ac:macro
-ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
- <h:inputText value="#{pageBean.foo}" immediate="true"
-valueChangeListener="#{pageBean.setFoo}"/>
-]
-]></ac:plain-text-body></ac:macro>
+ :::xml
+ <h:inputText value="#{pageBean.foo}" immediate="true"
+ valueChangeListener="#{pageBean.setFoo}"/>
<p>The referenced method looks like this:</p>
-<ac:macro
-ac:name="code"><ac:default-parameter>java</ac:default-parameter><ac:plain-text-body><![CDATA[
-// normal property setter
-public void setFoo(String val) {...}
-
-// immediate input hack: update model at apply-request, not update-model
-public void setFoo(ValueChangeEvent ev) {
- setFoo((String) ev.getNewValue());
- // prevent setter being called again during update-model phase
- ((UIInput) ev.getComponent()).setLocalValueSet(false);
-}
-]
-]></ac:plain-text-body></ac:macro>
+
+ :::java
+ // normal property setter
+ public void setFoo(String val) {...}
+
+ // immediate input hack: update model at apply-request, not update-model
+ public void setFoo(ValueChangeEvent ev) {
+ setFoo((String) ev.getNewValue());
+ // prevent setter being called again during update-model phase
+ ((UIInput) ev.getComponent()).setLocalValueSet(false);
+ }
<p>This effectively moves the update-model behaviour for the modified input
component from the update-model phase into the apply-request-values phase.
@@ -215,22 +206,20 @@ Validation Framework).</p>
<p>For example, if the problem is a required field, then do something like
this (untested code!):</p>
-<ac:macro
-ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
- <h:inputText required="#{!pageBean.cancelling}"/>
-]
-]></ac:plain-text-body></ac:macro>
-
-<ac:macro
-ac:name="code"><ac:default-parameter>java</ac:default-parameter><ac:plain-text-body><![CDATA[
- public boolean isCancelling() {
- // assumes cancelButton is a component binding
- FacesContext fc = FacesContext.getCurrentInstance();
- Map reqParams = fc.getExternalContext().getRequestParameterMap();
- return reqParams.containsKey(cancelButton.getClientId());
- }
-]
-]></ac:plain-text-body></ac:macro>
+In the page:
+
+ :::xml
+ <h:inputText required="#{!pageBean.cancelling}"/>
+
+In the bean:
+
+ :::java
+ public boolean isCancelling() {
+ // assumes cancelButton is a component binding
+ FacesContext fc = FacesContext.getCurrentInstance();
+ Map reqParams = fc.getExternalContext().getRequestParameterMap();
+ return reqParams.containsKey(cancelButton.getClientId());
+ }
<h4>Solution 4</h4>