I see where you are coming from with validating within the application but IMO the
disadvantages are greater
* Your entities get updated with invalid values (less of an issue with manual flushing as
Gavin says)
| * That's what @Invalid did and IIRC it didn't work brilliantly
| * As you say, harder to attach errors to the correct component on the page (the ease
with which this is possible in JSF is, IMO, one of its real strengths)
In JSF 1.2 there is the findComponent method available; using this it could be possible to
get another component, retrieve it's value and use it. It wouldn't really fit
with the validator annotations but could be good for custom validators. I will stew on
it.
The only way I found around the NotNull/required problem is to have a ModelValidator as a
component and, if the notnull annotation is on it's parent's value, automatically
sets required=true on it's parent; I did have something like this working in my
version of ModelValidator but then dumped it as I felt that (in my application) whether a
field was required or not was up to the view not the Entity (e.g. a customer is required
to enter more details than a account manager when setting up a new account)
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970202#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...