[jboss-user] [JBoss Seam] - Customize validation messages
do-not-reply at jboss.com
Wed Jan 3 13:07:20 EST 2007
I´m currently doing my first steps with Seam and JSF and, as a long-time Struts-developer, I already see so many improvements in the Seam/EJB3/JSF integration. Thank you for the great work!
But now I´m starting at a very basic problem: validation!
The struts way of life was that you have a validate()-method where you have to validate everything and if an error occured you can assign a customized error-message to an input-field that was localized through the RessourceBundle.
If I do the validation through jsf and the hibernate validation framework I get very unsexy error-messages like ""name": Value is required." if I set required = true and the field was left blank or "has to be between 3 and 2147483647 " or I get an output og my complete regexp if not left blank and the hibernate validation fails. What I would like to do is to show customized error-messages like "Please enter a valid email-adress" or "The password has to have at least 6 characters and 1 number" etc. One thing I found regarding customizing messages was redefining the properties like "javax.faces.component.UIInput.REQUIRED" in the message.properties. But this way the message cannot be customized for every single input-field. So what would be the right way to do in this case? Do I have to write my own validator and tag-library for every inputfield to archieve this (only to display different but customized messages) or is there an other - more elegant and less complex - way?
Thanks for your help
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3997645#3997645
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3997645
More information about the jboss-user