Hi Ture,
You should be able to get what you need by using the 'displayName' and
'message' attributes instead of 'displayNameKey' and 'messageKey'. The
former two can accept literal strings or expressions; the latter two
simply refer directly to messages in a message bundle. ** Note that
you'd need to use something other than '.' in your message key names --
the expression language will try to bind into properties through each '.' **
One alternative would be to use the 'bundleName' attribute in
conjunction with 'messageKey'/'displayName', e.g.,
[EMAIL PROTECTED](messageKey="error.required", bundleName="decValidation")
Either way should work -- let me know.
Rich
Ture Hoefner wrote:
>Hello,
>
>
>
>I'm trying to get i18n messages for declarative validation of my form
>bean. I can't use the default MessageBundle in this case and I can't
>get anything to work when I try to use another bundle. Is it possible?
>
>
>
>I don't understand the javadoc for
>Jpf.ValidatableProperty.displayNameKey: "A key in the default message
>bundle or in the bundle specified by [EMAIL PROTECTED]
>MessageBundle#bundleName}
>that will be used..."
>
>
>
>Here is my latest attempt, any hints would be appreciated. Thanks!
>
>
>
>@Jpf.Controller
>
>(
>
> messageBundles =
>
> {
>
> @Jpf.MessageBundle(
>bundlePath=ContentConstants.CONTENT_JSP_RESOURCE_BUNDLE ),
>
>
>
> // this message bundle annotation provides the message bundle
>that we use in
>
> // server-side declarative input validation
>
> @Jpf.MessageBundle( bundleName="decValidation",
>bundlePath="com.bea.jsptools.util.Validation")
>
> },
>
> validatableBeans =
>
> {
>
> @Jpf.ValidatableBean
>
> (
>
> type=RepositoryConfigForm.class,
>
> validatableProperties =
>
> {
>
> // name is required
>
> @Jpf.ValidatableProperty
>
> (
>
> propertyName=BaseContent.NAME_PROPERTY_NAME,
>
>
>displayNameKey="${bundle.decValidation.name.displayName}",
>
>
>[EMAIL PROTECTED](messageKey="${bundle.decValidatio
>n.error.required}")
>
> ),
>
>
>
> // connection class is required
>
> @Jpf.ValidatableProperty
>
> (
>
>
>propertyName=BaseContent.CONNECTION_CLASS_PROPERTY_NAME,
>
>
>displayNameKey="${bundle.decValidation.connectionClass.displayName}",
>
>
>[EMAIL PROTECTED](messageKey="${bundle.decValidatio
>n.error.required}")
>
> )
>
> }
>
> )
>
> }
>
>)
>
>
>
>
>
>
>
>