Return-Path: X-Original-To: apmail-struts-user-archive@www.apache.org Delivered-To: apmail-struts-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BB81710426 for ; Fri, 20 Sep 2013 11:24:50 +0000 (UTC) Received: (qmail 35695 invoked by uid 500); 20 Sep 2013 11:24:48 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 35672 invoked by uid 500); 20 Sep 2013 11:24:48 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 35664 invoked by uid 99); 20 Sep 2013 11:24:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Sep 2013 11:24:47 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [67.195.87.93] (HELO nm41-vm6.bullet.mail.gq1.yahoo.com) (67.195.87.93) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Sep 2013 11:24:38 +0000 Received: from [98.137.12.59] by nm41.bullet.mail.gq1.yahoo.com with NNFMP; 20 Sep 2013 11:24:15 -0000 Received: from [98.137.12.208] by tm4.bullet.mail.gq1.yahoo.com with NNFMP; 20 Sep 2013 11:24:15 -0000 Received: from [127.0.0.1] by omp1016.mail.gq1.yahoo.com with NNFMP; 20 Sep 2013 11:24:15 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 635538.88966.bm@omp1016.mail.gq1.yahoo.com Received: (qmail 2827 invoked by uid 60001); 20 Sep 2013 11:24:15 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1379676255; bh=FmP0NaipDmxmI48OnwjyjuczueYDM6x96xZTboEyB1U=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=1oSzYms8N9m+2yc59PyOgbcf5R3d3zjKIp1qLdOJ7+o7jVWalNiQkkfoM+g1XqvrpL13ECNhFVseuG0LUmV28FfglYNCwmpbxSUlCofzxT3uQwlsuceTSOIBfgPXwafz8bJRB5Q1UAWzS3X/i3BOXu2LZAfszDyr2pbvmJVFg/c= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=uj7mL0rzKcqUsl/rtICoJnHsTExSK0bkpV7CCp/px6vOP0f5k7gs0X5Pkdv5RVZ0F/Vyelx+JnNN1PKsc8qxEbd9T6E+81k/X/hwlfneIU10jTtSh6a3eTde/YSFp/VRmhM4Dr+KiVp+TxTRVniGZ89HWtKHY1uUSOoiMYZQfWg=; X-YMail-OSG: kfkdIQcVM1lutThSCHLdtA6Moemq92bHsA9iSMQG95dTfR9 F3WxG8C3CczxIXz1LUmCoFj0XfkxtmvmORiDZV1w45MEqq7V8TF22V1iXpVB 8AcfRWTzNfswM2aa12QMeecDZxB5Z3q_aL5LO8C6Ij.JYr5Nmhd2uTaou265 sM6MOTIBDo6vntseQK4K8rfTes5ImO7uZ5qbib8UKZ.XOsw9HWLRfOTGsfQM 8h_0oNEafSo93Gt5dsVbiNeKfWe41umt2xoVRhO7f3IsnFo4bg3LoTD7TKJq b8UpmUYLUaIOUeC3E1QJuf9qJvdX_kXyiZDPWvMcunSuSZegdL5W_BV3r5.r YTeyuHuBFy7CgKIxlCLYdzrSF0fyHbubuxGc2auBiPXBehYjn1un4njk2Emy WHKLEEdpVIUuuS9ym2C1PsAazF3cALX6XH4IbejTGGoRtIk_FiEzJfWl.hj_ ssyUFC_sQX8hNsvN5qvI5fGcokA.iXNjvSkWCPokZZQCM7ByUo5gkTiRdV8E qZfQuqvYI8w.BJyVLNpJW5sF.ZB_dpbym24_3BbJ7WCbiMoeUxFnOysG8YWr oxKh_YhzHByvhp52MC0CWyN2Zuh_Te6SAcS_JS_P1 Received: from [37.221.37.125] by web164002.mail.gq1.yahoo.com via HTTP; Fri, 20 Sep 2013 04:24:15 PDT X-Rocket-MIMEInfo: 002.001,TGV0IG1lIGFzayB0aGlzIHdheS4KSW4gYmVsb3cgdmFsaWRhdGlvbgpASW50UmFuZ2VGaWVsZFZhbGlkYXRvcih0eXBlID1WYWxpZGF0b3JUeXBlLkZJRUxELG1pbiA9IjEwIgoKaXMgdGhlcmUgYW55IHdheSB3ZSBjYW4gcmVhZCAnMTAnIGZyb20gZXh0ZXJuYWwgcmVzb3VyY2UgZmlsZXMgIQoKCsKgCn5SZWdhcmRzLAp.fkFsaXJlemEgRmF0dGFoaQoKCl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCiBGcm9tOiBMdWthc3ogTGVuYXJ0IDxsdWthc3psZW5hcnRAYXBhY2hlLm9yZz4KVG86IFN0cnUBMAEBAQE- X-Mailer: YahooMailWebService/0.8.157.561 References: <1379408605.8114.YahooMailNeo@web164004.mail.gq1.yahoo.com> Message-ID: <1379676255.127.YahooMailNeo@web164002.mail.gq1.yahoo.com> Date: Fri, 20 Sep 2013 04:24:15 -0700 (PDT) From: Alireza Fattahi Reply-To: Alireza Fattahi Subject: Re: How configure struts2 to get validation rules from Spring via @value To: Struts Users Mailing List In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-1649142802-1935691948-1379676255=:127" X-Virus-Checked: Checked by ClamAV on apache.org ---1649142802-1935691948-1379676255=:127 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Let me ask this way.=0AIn below validation=0A@IntRangeFieldValidator(type = =3DValidatorType.FIELD,min =3D"10"=0A=0Ais there any way we can read '10' f= rom external resource files !=0A=0A=0A=A0=0A~Regards,=0A~~Alireza Fattahi= =0A=0A=0A________________________________=0A From: Lukasz Lenart =0ATo: Struts Users Mailing List = =0ASent: Tuesday, 17 September 2013, 12:48=0ASubject: Re: How configure str= uts2 to get validation rules from Spring via @value=0A =0A=0ACode formattin= g? Maybe use some web service to present your code.=0A=0ADoes system.proper= ties is defined as a Struts 2 properties file?=0A=0A2013/9/17 Alireza Fatta= hi :=0A> We are using spring 3 and struts 2. We use spr= ing @value annotation to get values from property files.=0A> We want to get= validation rules from property files instead of hard-coding them in action= .=0A> Here is sample property system.properties transfer.account.min.amount= =3D10=0A> Here is the action:=0A> publicclassTransferToAccountimplementsPre= parable{@Value("${transfer.account.min.amount}")publicStringminAmount;//...= ........execute and other methods omitted@IntRangeFieldValidator(type =3DVa= lidatorType.FIELD,min =3D"${minAmount}",key =3D"validate.int.min")publicvoi= dsetAmount(Integeramount){this.amount =3Damount;}=0A> The minAmount is popu= lated correctly by value 10, but the validation is not working.=0A> _______= _________________________=0A>=0A> To see if parameters are passed correctly= , I make a test as below.=0A> Assume we want to get a key from spring manag= ed property file ( This is just a test ;) )=0A> system.properties=0A> trans= fer.account.min.amount.key=3Dvalidate.int.min=0A> The resource bundel is: v= alidate.int.min =3D This field must be more than ${min}=0A> ...and make thi= s change=0A> @IntRangeFieldValidator(type =3DValidatorType.FIELD,min =3D"${= minAmount}",key =3D"${transfer.account.min.amount.key}")=0A> Now when an er= ror happens the validation message shows validate.int.min, instead of fetch= ing this value from resource bundle!=0A> Of course, when you run below code= :=0A> @IntRangeFieldValidator(type =3DValidatorType.FIELD,min =3D"${minAmou= nt}",key =3D"validate.int.min")=0A> The error message is fetched resource b= undle correctly!=0A> ________________________________=0A>=0A> If I can use = annotation in this way, please let me know what is my mistake!=0A> If I can= not use annotations like this, please let me know what is=0A> the best way= to avoid hard coding the validaiton rolls in actions.=0A>=0A>=0A> ~Regards= ,=0A> ~~Alireza Fattahi=0A=0A----------------------------------------------= -----------------------=0ATo unsubscribe, e-mail: user-unsubscribe@struts.a= pache.org=0AFor additional commands, e-mail: user-help@struts.apache.org ---1649142802-1935691948-1379676255=:127--