There's a scene in The Hitchhiker's Guide to the Galaxy that goes:He reached out and pressed an invitingly large red button on a nearby panel. The panel lit up with the words Please do not press this button again.
Clearly this is a joke: it's funny because it's obviously bad user interface design. Yet this is precisely where we are today with Java EE 6.
Don't get me wrong: I think Java EE 6 is an awesome spec, and I think Bean Validation and JSF2 work really well together, but just like Seam's s:validateAll, the best you can do is validate the input after the user interaction:
- give them a text box, then afterwards tell them their input was too long
- give them a text box, then afterwards tell them number must be less than 100
- give them a date picker, then afterwards tell them date of birth must be less than today
- give them a text box limited to a certain number of characters
- give them a number spinner (or slider) capped at 100
- give them a date picker capped to before today
There are a variety of ways to achieve this, and obviously I'm biased. But whichever approach we use, I think it's the next logical step - and the final frontier in establishing validation constraints that apply all the way from the back end to the front end.
