There is nothing wrong with the data. There is only one UIInput component in the JSF component tree, the state of which changes each time the parent UIData component UIData over each element of the model. Thus, the state is available only during UIData iteration, and not before or after. You are trying to access the value of a single component in a bean action method, while the parent UIData component UIData not iterate over it, so the values will always return null .
You need to visit the UIComponent#visitTree() component tree on UIData and collect the information of interest in the VisitCallback implementation.
table.visitTree(VisitContext.createVisitContext(FacesContext.getCurrentInstance()), new VisitCallback() { @Override public VisitResult visit(VisitContext context, UIComponent target) { if (target instanceof UIInput) { UIInput input = (UIInput) target; System.out.println("id: " + input.getId()); System.out.println("value: " + input.getValue()); } return VisitResult.ACCEPT; } });
By the way, you usually do validation with a normal Validator on a UIInput component UIInput or, in this particular case, perhaps better, a ValueChangeListener . This simplifies invalidation and message processing.
source share