I have come across some situations in which input controls are used that do not have the value
attribute set, i.e. they have no direct representation in the backing bean.
User input is handled entirely by ajax listeners. An example are the input elements of the column filters in the primefaces table.
However, when dealing with such input fields, MyFaces warns me about each:
Feb 09, 2017 3:04:51 PM javax.faces.validator.BeanValidator validate
WARNING: cannot validate component with empty value: my_form:myTableId:j_id_1s
In a way, this problem has already been mentioned here: p:datatable filter: cannot validate component with empty value
My question is: What is the best practice in situations like this?
1. An input element should always have a reference in the backing bean, everything else is a design error
Not true.
2. Just use a "dummy" value that points to an unused field in the bean.
No. That's ridiculous in short term and confusing in long term at best.
3. Suppress the validation of that input element. (How?)
You could do. You can use <f:validateBean>
for that.
<h:inputXxx>
<f:validateBean disabled="true" />
</h:inputXxx>
4. Suppress the MyFaces warning somehow. (How?)
Based on its source code there doesn't seem to be any way. You'd best ask them to log it only during Development
stage.