[jsr-314-open] inter-component and form-level validation

Dan Allen dan.j.allen at gmail.com
Tue Jul 28 14:16:27 EDT 2009


Okay, so to restate and reignite this discussion, let me seed the topic.

Several members of the EG and many other community members have voiced their
concern that the validation mechanism in JSF is insufficient, particularly
in regard to inter-component validation, and needs to be
rethought/redesigned in a future release. I am deciphering two concerns.

1) Validation is happening in two places, once before model update and once
after, which confuses the user (they have to submit the form twice to get
all the validation errors)
2) Inter-component validation is very complex and in some cases, not
possible without a lot of code stealing from the implementation

There are two root causes that have been identified:

1) The assumption that validation should happen before model update, thus
making it possible to only partially use Bean Validator (and the like)
2) The coupling of conversion and validation in the life cycle (each
component is converted then validated in turn)

The second root cause is easier to solve than the first. Norbert and I
(perhaps others as well) believe everything would get a whole lot simpler to
start with if conversion was completed before validation began so that when
inter-component validation is attempted, all values are in their converted
state.

The first root cause is much more challenging because if a value cannot be
converted, and you continue into validation, you run the risk of undefined
behavior. I suppose you could say that a value which could not be converted
results in a null value being assigned with a FacesMessage registered. But
are two attempts to submit the form that result in different validation
messages really a bad thing. If you enter a bogus number in a number field,
the form will yell at you that it cannot proceed without a number. When you
enter a number, it may then turn out to be out of range, and that to me is a
logical progression.

So the floor is open to discuss a general model for handling validation.
Please cite use cases and case studies if necessary. We simply cannot let
another JSF revision go by without there being a general agreement that
validation is sufficient for the development of web applications.

-Dan

-- 
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597

http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://in.relation.to/Bloggers/Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jsr-314-open-mirror/attachments/20090728/60b7e17e/attachment.html 


More information about the jsr-314-open-mirror mailing list