Ah, yes Eddie. I bet that will work.
For the record, I went with a bundleName attribute on my
ValidateRequired annotations and it worked fine. The bundleName is
applied not only to the messageKey for ValidateRequired, but also to the
displayNameKey for ValidatableProperty. The only gotcha I had was that
you must use validatorVersion=Jpf.ValidatorVersion.oneOne (instead of
the default ValidatorVersion.oneZero) if you use this approach. The
error message I got when I built with ValidatorVersion.oneZero was a
VERY good error message because it told me exactly how to fix it (thanks
to whoever did that).
@Jpf.ValidatableProperty
(
// The bundleName in the ValidateRequired annotation will not only
be applied to the messageKey
// for ValidateRequired, but also to the displayNameKey for
ValidatableProperty.
propertyName=BaseContent.NAME_PROPERTY_NAME,
displayNameKey="name.displayName",
[EMAIL PROTECTED](messageKey="error.required",
bundleName="decValidation" )
),
...
-------------------
Ture Hoefner
WebLogic Portal Engineering
BEA Systems, Inc.
-----Original Message-----
From: Eddie O'Neil [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 08, 2005 4:22 PM
To: Beehive Users
Subject: Re: using non-default MessageBundle with
Jpf.ValidatableProperty
One point on the dot-separator issue, try the following:
${bundle.someBundle['some.dot.separated.message.name']
which should work in the JSP 2.0 EL.
Eddie
On 11/8/05, Rich Feit <[EMAIL PROTECTED]> wrote:
> Glad you have something that works, Ture.
>
> The displayNameKey is always applied in the context of each individual
> message, so I think it would work if you put a bundleName in each
> @Jpf.Validate*. But it does seem reasonable to have a value that
would
> apply to all messages inside the @Jpf.ValidatableProperty.
>
> Carlin, what do you think of that?
>
> Rich
>
> Ture Hoefner wrote:
>
> >Thanks Rich,
> > I have a ton of message keys delimited by '.', so I am going to use
an
> >alternative to binding expressions such as
> >"${bundle.decValidation.errorRequired}".
> >
> > I can now see the bundleName attribute on the Jpf.ValidateRequired
> >annotation (thanks). However, I still don't see how to set
bundleName
> >for the Jpf.ValidatableProperty annotation. Maybe the
> >ValidatableProperty annotation was meant to have a bundleName
attribute
> >but it got missed?
> >
> > In any case, I found a workaround that works. I use an annotation
on
> >my form bean. It's not ideal because I'd rather keep the message
bundle
> >annotation with the base flow controller, but this is fine for now:
> >
> >
> >@Jpf.FormBean
> >(
> > messageBundle="com.bea.jsptools.util.Validation"
> >)
> >public class RepositoryConfigForm extends FormData
> >
> >
> >Ture
> >
> >
> >-----Original Message-----
> >From: Rich Feit [mailto:[EMAIL PROTECTED]
> >Sent: Tuesday, November 08, 2005 3:31 PM
> >To: Beehive Users
> >Subject: Re: using non-default MessageBundle with
> >Jpf.ValidatableProperty
> >
> >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
> >
> >
> >
> >
> >
>