Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 56721 invoked from network); 30 Aug 2005 16:12:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 30 Aug 2005 16:12:40 -0000 Received: (qmail 58751 invoked by uid 500); 30 Aug 2005 16:12:34 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 58314 invoked by uid 500); 30 Aug 2005 16:12:33 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 58301 invoked by uid 99); 30 Aug 2005 16:12:33 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Aug 2005 09:12:33 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [217.12.12.141] (HELO smtp804.mail.ukl.yahoo.com) (217.12.12.141) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 30 Aug 2005 09:12:49 -0700 Received: (qmail 28809 invoked from network); 30 Aug 2005 16:12:27 -0000 Received: from unknown (HELO ?192.168.1.2?) (f.mcrae@hg25.btinternet.com@86.131.218.170 with login) by smtp804.mail.ukl.yahoo.com with SMTP; 30 Aug 2005 16:12:27 -0000 Received: from 127.0.0.1 (AVG SMTP 7.0.344 [267.10.17]); Tue, 30 Aug 2005 17:14:14 +0100 Message-ID: <431485D6.4070809@planetzorbo.co.uk> Date: Tue, 30 Aug 2005 17:14:14 +0100 From: David Duff Reply-To: david.duff@planetzorbo.co.uk User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jakarta Commons Users List Subject: Re: [Validator] Commons Validator problem References: <430D862B.8050605@planetzorbo.co.uk> <431480D5.3000402@planetzorbo.co.uk> <023101c5ad7d$8e755aa0$0200a8c0@DELL1800> In-Reply-To: <023101c5ad7d$8e755aa0$0200a8c0@DELL1800> 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, Not using struts, using commons-validator. David Niall Pemberton wrote: >The message handling will be in your custom validator - so without seeing >how thats working its impossible to know why this isn't working for you. > >Are you using this with Struts? If so, does the *standard* struts minlength >validator work properly? > >Niall > >----- Original Message ----- >From: "David Duff" >Sent: Tuesday, August 30, 2005 4:52 PM > > > > >>Hi >> >>I am baffled to why the name and resource attributes in the arg and msg >>seem not to work in my application. Surely someone has used validator >>with a second argument, overridden the default message, or set resource >>to false in their configuration. I was thinking that the problem I have >>was of my making. >> >>Can someone please tell me why these attributes won't work on my >>application? All the information that you will need is below: >> >>Thanks in advance, >>David >> >>David Duff wrote: >> >> >> >>>Hi, >>> >>>That doesn't work for me. It keeps printing out the message I defined >>>in validation-rules.xml minus the second arg because it is not defined >>>anymore. >>> >>>>> name="minlength" >>>classname="com.company.product.controller.validator.CustomValidator" >>> method="validateMinLength" >>> methodParams="java.lang.Object, >>> org.apache.commons.validator.Field" >>> *msg="errors.min"*/> >>> >>>Is there any way to override this message with the one in validator.xml? >>> >>> >>> >>>Thanks in advance, >>>DAvid >>> >>> >>> >>> >>> >>>Aaron Sheffey wrote: >>> >>> >>> >>> >>> >>>>If you want to print out a specific message for the validation, you can >>>>add that to the field, too: >>>> >>>> >>>> >>>> minlength6 >>>> >>>> >>>> >>>> >>>> >>>> >>>>David Duff >>>>08/24/2005 12:09 PM >>>>Please respond to >>>>"Jakarta Commons Users List" >>>> >>>> >>>>To >>>>Jakarta Commons Users List >>>>cc >>>> >>>>Subject >>>>Re: Commons Validator problem >>>> >>>> >>>> >>>> >>>> >>>> >>>>Hi, >>>> >>>>Thanks for the reply >>>> >>>>The msg I want to print out has two arguments: >>>> >>>>errors.min=The {0} must have at least {1} characters. >>>> >>>>This would leave: >>>> >>>>The user name must have at least {1} characters. >>>> >>>>I can get round the problem I'm having by specifying a value in the >>>>resource like >>>> >>>> >>>> >>>> >>>> >>>>minlength6 >>>> >>>> >>>> >>>>properties file: >>>>user.min= 6 >>>> >>>>I would like to do it like it was specified in the user guides instead >>>>of intoducing a workaround and having to input the value twice. Once in >>>>the resource and another in the validator.xml. >>>> >>>>Thanks in advance. >>>>David >>>> >>>>Aaron Sheffey wrote: >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>>>You probably don't need to specify all the other stuff in the field. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>Based >>>> >>>> >>>> >>>> >>>> >>>> >>>>>on what I have done with mask, do something like >>>>> >>>>> >>>>> >>>>> minlength6 >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>David Duff >>>>>08/24/2005 11:43 AM >>>>>Please respond to >>>>>"Jakarta Commons Users List" >>>>> >>>>> >>>>>To >>>>>commons-user@jakarta.apache.org >>>>>cc >>>>> >>>>>Subject >>>>>Commons Validator problem >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>Hi, >>>>> >>>>>I am trying to specify a min. length for a user name field in my >>>>>application. >>>>> >>>>>In my validatior.xml I have specified: >>>>> >>>>>| >>>>> >>>>> >>>>position="1"||/> >>>>> minlength6 >>>>> >>>>> >>>>>In my validator-rules.xml I have: >>>>> >>>>>>>>> name="minlength" >>>>>classname="com.company.product.controller.validator.CustomValidator" >>>>> method="validateMinLength" >>>>> methodParams="java.lang.Object, >>>>> org.apache.commons.validator.Field" >>>>> msg="errors.min"/> >>>>> >>>>>In my custom validator I have my validateMinLength() method. >>>>> >>>>>I would expect the two arguments (user.username and minlength) to get >>>>>picked up but it only picks up the first argument even though ||I can >>>>>see the two args in the field object||. When I remove the name >>>>>attribute from arg, it will then pick up the second argument but look >>>>>for the key in the resource even although resource is set to false. >>>>> >>>>>I am using commons-validator-1.1.4.jar| >>>>> >>>>>Can anyone tell me what I'm doing wrong? >>>>> >>>>>Thanks in advance. >>>>>David >>>>> >>>>> > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: commons-user-help@jakarta.apache.org > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org