Return-Path: Delivered-To: apmail-struts-issues-archive@locus.apache.org Received: (qmail 96226 invoked from network); 13 Feb 2008 01:16:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Feb 2008 01:16:02 -0000 Received: (qmail 74499 invoked by uid 500); 13 Feb 2008 01:15:55 -0000 Delivered-To: apmail-struts-issues-archive@struts.apache.org Received: (qmail 74459 invoked by uid 500); 13 Feb 2008 01:15:55 -0000 Mailing-List: contact issues-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list issues@struts.apache.org Received: (qmail 74450 invoked by uid 99); 13 Feb 2008 01:15:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Feb 2008 17:15:55 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Feb 2008 01:15:32 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 6EABD71406D for ; Tue, 12 Feb 2008 17:15:40 -0800 (PST) Message-ID: <14191220.1202865340450.JavaMail.jira@brutus> Date: Tue, 12 Feb 2008 17:15:40 -0800 (PST) From: "Dave Newton (JIRA)" To: issues@struts.apache.org Subject: [jira] Closed: (WW-2485) Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting In-Reply-To: <8667787.1202846620069.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/struts/browse/WW-2485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Dave Newton closed WW-2485. --------------------------- Resolution: Not A Problem Short-circuiting is for validators on a *single* field, AFAIK: this means that when the first field validation fails no other validators will be run for that field. See http://struts.apache.org/2.x/docs/validation.html towards the bottom and, for example, the RequireStringValidator annotation JavaDocs. It's not clear to me if setting the validator type to Validator.SIMPLE (as opposed to the default Validator.FIELD) will cause the behavior you want, but I'm pretty sure you're misunderstanding short-circuiting. I'm going to close this issue; if you have further questions please ask on the struts-user list as this isn't really an appropriate discussion forum. If after getting answers on the struts-user list you still feel there's a bug you may re-open this issue or create a new one. Thanks! > Annotation validations (@StringFieldValidator, @StringLengthFieldValidator) doesn't work while @RequiredStringValidator doesn't do shortcircuiting > -------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: WW-2485 > URL: https://issues.apache.org/struts/browse/WW-2485 > Project: Struts 2 > Issue Type: Bug > Components: XML Validators > Affects Versions: 2.0.11 > Environment: Windows XP SP2, Struts 2.0.11, Jetty 6.0.1 > Reporter: Zahid Nazir > > Hi, > Validation (client or server side) doesn't occur and no message is thrown back when annotating setters (I checked getter too but to no affect),see below > // @StringLengthFieldValidator(message="Default message", key="errors.required.first", shortCircuit=true, trim=true, minLength="1", maxLength="35") > // @RequiredFieldValidator(message = "You must enter a string value for first...", key="errors.required.last", shortCircuit=true) > @RequiredStringValidator(message = "First", key="errors.required.first", shortCircuit=true, trim=true) > public void setFirst(String first) { > this.first = first; > } > Validation does get invoked for @RequiredStringValidator but then shortCircuit doesn't seem to work. > Here is the class declaration > @Validation() > public class ProfileSearch extends ActionSupport { > // getter > // @StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35") > // @RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true) > @RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true) > public String getLast() { > return last; > } > // Setter > // @StringLengthFieldValidator(message="Default message", key="errors.required.last", shortCircuit=true, trim=true, minLength="1", maxLength="35") > // @RequiredFieldValidator(message = "You must enter a string value for last...", key="errors.required.last", shortCircuit=true) > @RequiredStringValidator(message = "Last", key="errors.required.last", shortCircuit=true, trim=true) > public void setLast(String last) { > this.last = last; > } > and jsp snippet > > > > I also used ModelDriven validation using annotations and behavior is same. Adding namespace attribute to form element and in struts.xml also doesn't help, neither do changing attribute validate="true". I am not declaring any interceptors in struts.xml and am extending my package from struts-default. > Thanks for your help. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.