You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Chris <ch...@yahoo.fr> on 2015/09/03 11:37:48 UTC
Re: about struts-examples apache/struts-examples -> bean-validation
example
Hello,
The bean-validation example works now, after adding jboss-logging-3.1.1.GA.jar
I didn't know I could use a jboss file jar with only Netbeans 7.3 and Apache Tomcat 7.0.34.So the java jar file influence the validation and the message errors directly on html page.
PS : with the exclude_parameters example, the errors messages are not in the same files
=======================================
exclude_parameters :
EditAction.properties
personBean.firstName=First name
EditAction-validation.xml
<validators>
<validator type="requiredstring">
<param name="fieldname">personBean.firstName</param>
<message>First name is required.</message>
</validator>
===================================
bean-validation ( All is in EditAction.properties )
EditAction.properties
personBean.firstName=First name
firstName.required=You must enter the first name===============================================
Regards,
Chris
Re: about struts-examples apache/struts-examples -> bean-validation example
Posted by Christoph Nenning <Ch...@lex-com.net>.
> So the java jar file influence the
> validation and the message errors directly on html page.
When you don't specifiy own messages/text-keys in validation annotations
the bean-validation framework uses default messages. In your case these
messages should come from hibernate-validation.jar.
Here is an example from struts docs how you can use an own text-key:
@NotNull(message="your.text.key.here")
http://struts.apache.org/docs/bean-validation-plugin.html
Regards,
Christoph
> From: Chris <ch...@yahoo.fr>
> To: Lukasz Lenart <lu...@apache.org>,
> "user@struts.apache.org" <us...@struts.apache.org>, Struts Users
> Mailing List <us...@struts.apache.org>,
> Date: 03.09.2015 11:38
> Subject: Re: about struts-examples apache/struts-examples -> bean-
> validation example
>
> Hello,
>
> The bean-validation example works now, after adding
jboss-logging-3.1.1.GA.jar
>
> I didn't know I could use a jboss file jar with only Netbeans 7.3
> and Apache Tomcat 7.0.34.So the java jar file influence the
> validation and the message errors directly on html page.
>
>
> PS : with the exclude_parameters example, the errors messages are
> not in the same files
> =======================================
> exclude_parameters :
> EditAction.properties
> personBean.firstName=First name
>
> EditAction-validation.xml
> <validators>
> <validator type="requiredstring">
> <param name="fieldname">personBean.firstName</param>
> <message>First name is required.</message>
> </validator>
>
> ===================================
>
> bean-validation ( All is in EditAction.properties )
>
> EditAction.properties
> personBean.firstName=First name
> firstName.required=You must enter the first
> name===============================================
>
> Regards,
>
> Chris
>
>
This Email was scanned by Sophos Anti Virus