Return-Path: Delivered-To: apmail-beehive-user-archive@www.apache.org Received: (qmail 81678 invoked from network); 8 Nov 2005 22:31:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 8 Nov 2005 22:31:36 -0000 Received: (qmail 36976 invoked by uid 500); 8 Nov 2005 22:31:35 -0000 Delivered-To: apmail-beehive-user-archive@beehive.apache.org Received: (qmail 36951 invoked by uid 500); 8 Nov 2005 22:31:35 -0000 Mailing-List: contact user-help@beehive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Beehive Users" Delivered-To: mailing list user@beehive.apache.org Received: (qmail 36936 invoked by uid 99); 8 Nov 2005 22:31:35 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Nov 2005 14:31:35 -0800 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=RCVD_IN_SORBS_WEB,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of richfeit@gmail.com designates 64.233.184.200 as permitted sender) Received: from [64.233.184.200] (HELO wproxy.gmail.com) (64.233.184.200) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Nov 2005 14:31:28 -0800 Received: by wproxy.gmail.com with SMTP id 68so25092wri for ; Tue, 08 Nov 2005 14:31:13 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=dgB2/aqZgjGedh/sWjKB4KYvkfVdsy6kaYM1EgO7P/4SsGu8R7Us0aa3YjaOyPBCxf46lIN8/BIRv7hQuj1RoVQBw1TgE0o9oojE5lE6xs2v0qPdJDYTcfQ57+CZ4EWtrl2cugd2N4k8KxrFFBeJEqF97DKV8kmketSmNrRltWs= Received: by 10.54.112.11 with SMTP id k11mr5753119wrc; Tue, 08 Nov 2005 14:31:13 -0800 (PST) Received: from ?10.36.32.225? ( [63.96.162.1]) by mx.gmail.com with ESMTP id 29sm118742wrl.2005.11.08.14.31.09; Tue, 08 Nov 2005 14:31:10 -0800 (PST) Message-ID: <43712729.2030602@gmail.com> Date: Tue, 08 Nov 2005 15:31:05 -0700 From: Rich Feit User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Beehive Users Subject: Re: using non-default MessageBundle with Jpf.ValidatableProperty References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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., validateRequired=@Jpf.ValidateRequired(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 {@link 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}", > > >validateRequired=@Jpf.ValidateRequired(messageKey="${bundle.decValidatio >n.error.required}") > > ), > > > > // connection class is required > > @Jpf.ValidatableProperty > > ( > > >propertyName=BaseContent.CONNECTION_CLASS_PROPERTY_NAME, > > >displayNameKey="${bundle.decValidation.connectionClass.displayName}", > > >validateRequired=@Jpf.ValidateRequired(messageKey="${bundle.decValidatio >n.error.required}") > > ) > > } > > ) > > } > >) > > > > > > > >