Hi!
I need to find a way to internationalise the error message for a specific
property on an entity bean. All the examples I found use static text like this
@NotNull
@Length(min = 2, message="Lastname has to be 2 characters of longer.")
public String getLastName()
{
return lastName;
}
I would like to internationalise these message (like the rest of the app) and
would prefer to be able to keep the concern of the message within the entity.
So I tried this
@In(create = true)
private transient ResourceBundle resourceBundle;
@NotNull
@Length(min = 2, message=resourceBundle.getString("person.lastName.length"))
public String getLastName()
{
return lastName;
}
but unfortunately the message has to be a constant expression so that does not
work. Ideally something like this would work, where the message is
automagically taken from the bundle.
@NotNull
@Length(min = 2, message=person.lastName.length))
public String getLastName()
{
return lastName;
}
Any pointers would be great. Also let me know if you think I should not have
any of those messages linked to the entity directly even though the defaults
will always kick in..
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965548#3965548
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965548
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user