Details
-
Type: New Feature
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.7.1
-
Component/s: ICE-Components
-
Labels:None
-
Environment:All
-
Affects:Documentation (User Guide, Ref. Guide, etc.), Sample App./Tutorial
Description
Throughout the forums, users are complaining about the fact that ValueChangeEvents happen before UPDATE_MODEL_VALUES, so if they programmatically set the values for other input components, then those values will be stomped over with the decoded (converted and validated) values. There are two main solutions, to clear out the submitted values on the target components, or to re-queue the ValueChangeEvent to INVOKE_APPLICATION, which requires bean code modifications.
What would be simpler is to add a component, ice:eventSetPhase, which could override UIComponentBase.queueEvent(FacesEvent), and reset the PhaseId on the FacesEvents passing through. That way, ValueChangeEvents from child components could be flipped to INVOKE_APPLICATION.
By default it would change all FacesEvents to INVOKE_APPLICATION, but it would have two attributes to optionally constrain this behaviour. The "events" attribute would be a space delimited list of class types to act on, and the "phase" attribute would be the PhaseId to set the FacesEvents to.
Here's a discussion on the topic in the JSF RI dev mailing list:
https://javaserverfaces.dev.java.net/servlets/ReadMsg?list=dev&msgNo=1750
What would be simpler is to add a component, ice:eventSetPhase, which could override UIComponentBase.queueEvent(FacesEvent), and reset the PhaseId on the FacesEvents passing through. That way, ValueChangeEvents from child components could be flipped to INVOKE_APPLICATION.
By default it would change all FacesEvents to INVOKE_APPLICATION, but it would have two attributes to optionally constrain this behaviour. The "events" attribute would be a space delimited list of class types to act on, and the "phase" attribute would be the PhaseId to set the FacesEvents to.
Here's a discussion on the topic in the JSF RI dev mailing list:
https://javaserverfaces.dev.java.net/servlets/ReadMsg?list=dev&msgNo=1750
Yes, we don't have an example of how, without this tag, the code would be broken. I'm not sure that people would understand an application misbehaving, as an example. But what is does demonstrate, is how much simpler this tag is, than the work-arounds used in the Selection example. Both are valid ways of solving the problem, but setEventPhase is simpler, doesn't require any bean code, and is more declarative.