I\'ve been developing a few JSF applications lately and am disturbed with the inconsistency in the web component APIs.
I\'ve noticed that there is extremely unpredi
TL;DR answer:
UIViewRoot viewRoot = context.getViewRoot();
UIInput input = (UIInput)viewRoot.findComponent(":form:inputID");
String inputValueString;
if (input.isLocalValueSet()) {
inputValueString = (String)input.getValue(); //validated and converted already
} else {
inputValueString = (String)input.getSubmittedValue(); //raw input
}
or at least that's what the other answers are saying to do...
Just use .getSubmittedValue()
and deal with the consequences of having to convert raw input (if necessary, if that raw input needs conversion). .getValue()
is broken in this regard, even with the code above. It delays the submitted value if you use it and that's unacceptable.