the following setting in web.xml is quite useful:
...
<context-param>
<param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
<param-value>true</param-value>
</context-param>
...
which means that when a user submits a form then no empty fields of type string will get saved in the database. having it set to true will also force compliance with @NotNull constraints, with regards to validation.
on a related note, there's a jboss startup setting called org.apache.el.parser.COERCE_TO_ZERO, which when set to true (default) will turn number field form values of "" (empty string) and null into the number 0 (zero) before the form is submitted, e.g.:
-Dorg.apache.el.parser.COERCE_TO_ZERO=true
setting it to false would mean that empty strings and null values for number fields in forms will be submitted "as is" and NOT get converted to the number 0.
IT, computer and programming tutorials and tips that i couldnt find anywhere else using google, from my daily work as a Senior Developer of solutions using Java and Linux.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment