Hello Seam 2.3 users,
I'm converting my seam 2.2 application to seam 2.3 and I'm almost finished.
There's only 1 problem I can't solve yet: disabling jsr 303 bean validation for my search facelets.
Bean validation is great, but for searching to entities you want to reuse your jsr303 annotated pojo's, but without the bean validation:
I want to search for persons by firstName, so I only enter the firstName, without the also required lastName. The search isn't executed, because bean validation says the required field lastName is empty.
There are a lot JSF users with the same problem:
The solutions found in the forums (<f:validateBean disabled="true" />) don't work, because seam adds his own validators.
After spending a lot of time to search for a solution I discovered the validate-model attribute of a page.xml file and the validateModel attribute of a param element inside a page element. I didn't find documentation about this attributes, but I understand it's a way to disable bean validation for some pages which is exactly what I need! Unfortunately the solution doesn't work.
I checked out the seam 2.3 branch from the git repository and started debugging. I found out that the attributes are read correctly from the page.xml files, but it seems like they aren't used in the application.
This class is always validating the model without looking at the value of the validateModel attribute:
The jboss-seam project contains this class and method:
org.jboss.seam.navigation.Param.validateConvertedValue(FacesContext facesContext, Object value)
but when setting a breakpoint inside this method I found out the code isn't executed. There is a TODO at line 256 referring to the ModelValidator class.
I've a couple of questions
- Is the validate-model attribute and validateModel attribute the way to disable bean validation for some page or param? It looks like a very elegant way to disable builtin validation.
- Should f:validateBean disabled="true" work in a seam application
- Did I find a bug?
I'm very happy with the new seam 2.3 version and it's important for me I can still use Seam in a JEE6, JSF2 and JPA2 environment and of course with JBoss 7.1.
Marnix van Bochove