I need some default behaviours in form such as:
2.1 Combo box group will be none is selected at the beginning of view.
2.2 Date picker will be empty at the beginning of view.
I need bean validation for user inputs if button pressed.
For taking all values from a form what i need to do:
Create an empty bean.
Bind this bean with a form.
I find that i need to set all default values for this form. For example a birthday, i need to bind setter and getter and give a default value a localdate in the bean. If not binder will complain that it try to set a null value from bean to form.
Meanwhile i don’t need to set all default values in form because all this value must be empty as default in a form if i dont use binder.
Question is all default value should be set if we want to use binder?
Or even it is a best practice to set all default value in a form?
What do you mean with default values? null is a default value, so there is nothing to be set. If you want to use e.g. 1980-01-01 as default value because it was e.g. preselected in the bean; add this field / attribute to your bean and let the binder read it.