[jboss-user] [JBoss Seam] - Re: Customize validation messages
hamtho2
do-not-reply at jboss.com
Thu Jan 4 05:52:31 EST 2007
Thanks for your help! Norman, your solution worked perfectly as I wanted it to be, besides the fact that you have to use a slightly different annotation if you want to use messages fro the seam resourceBundle which caused me some confusions until I realized that fact. So if anyone else has the same problem use this syntax as an example:
@Length(min=3, message="#{messages['validation.user.name.length']}")
But I´d like to extend this topic a little bit, because I have some more questions about that. Unfortunately the hibernate validation were not used if the required=true attribute is missing in the jsf-tag. Although I´d say that for example a @Length(min=3) annotation also means that it should not be empty and for some reason the @NotEmpty-annotation is not supported with the current seam-release (is there a reason?).
So I have to add the required="true" attribute to every input field to work with the hibernate validation. Is there also a possibility to customize the "field-is-required"-messages for every input field, so it is not the standard-message from "javax.faces.component.UIInput.REQUIRED" for every field?
I saw, that sun uses a syntax like in the following code-snippet, to provide this functionality but it doesn´t seem to be a standard-jsf-tag:
<h:inputText id="ccno" size="19"
| required="true"
| requiredMessage="#{customMessages.ReqMessage}" >
| ...
| </h:inputText>
| <h:message styleClass="error-message" for="ccno"/>
Furthermore I get an error while trying to use the sun jsf-impl, whereas myfaces works perfectly. But that´s probably another topic.
So is there also a solution to this problem?
Thank you very much for your help
Thomas
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3997877#3997877
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3997877
More information about the jboss-user
mailing list