Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>When a partial submit is executed, the full JSF lifecycle is still executed. Thus, the validation phase is still processed, and all of the components in the component hierarchy are validated.</p> <p>There are good reasons for this. A change in one component could cause a (potentially invalid) change in another component. For example, a selection from a <code>selectOneMenu</code> could set a value in a <code>inputText</code>.</p> <p>ICEfaces alters processing in one significant way: During a partial submit, ICEfaces temporarily marks all components other than the one that triggered the sumbit as optional (<code>required="false"</code>). Thus, "required" validations are skipped. However, ICEfaces does not disable the other validations.</p> <p>There are two possible solutions to this problem:</p> <ol> <li><p>Set <code>immediate="true"</code> in addition to <code>partialSubmit</code>. This changes the lifecycle slightly for the component when the partial submit is executed to perform the validation in the apply request values phase. This may cause the other validations to be skipped.</p></li> <li><p>Detect if a partial submit occurred in your custom validator. Skip the validation if it isn't the component that triggered the partial submit. Unfortunately, there isn't any documentation on how to detect a partial submit, but I found the solution in the source code for the <code>com.icesoft.faces.application.PartialSubmitPhaseListener</code> class. </p> <p>It turns out that ICEfaces adds two request parameters when a partial submit is executed: </p> <ul> <li><code>ice.submit.partial</code> - set to "true" to indicate that a partial submit was done.</li> <li><code>ice.event.captured</code> - contains the component ID of the component that generated the partial submit.</li> </ul></li> </ol> <p>You can take advantage of these two parameters in your validation methods. Here's an example:</p> <pre><code>public void validateAccount(FacesContext context, UIComponent component, Object value) { if(!partiallySubmitted(context) || componentWasPartiallySubmitted(context, component) // Perform validation } } public boolean partiallySubmitted(FacesContext context) { ExternalContext externalContext = context.getExternalContext(); Map parameterMap = externalContext.getRequestParameterMap(); return "true".equals(parameterMap.get("ice.submit.partial")); } public boolean componentWasPartiallySubmitted(FacesContext context, UIComponent component) { ExternalContext externalContext = context.getExternalContext(); Map parameterMap = externalContext.getRequestParameterMap(); String componentId = (String) parameterMap.get("ice.event.captured"); return component.getClientId(context).equals(componentId); } </code></pre> <p>Of course, accessing the two request parameters directly is probably unsupported. However, until the ICEfaces team provides a supported way to "detect" a partial submit, it may be your only option.</p>
    singulars
    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. 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.
 

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