Return-Path: X-Original-To: apmail-struts-issues-archive@minotaur.apache.org Delivered-To: apmail-struts-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 97898EDE4 for ; Thu, 10 Jan 2013 00:22:14 +0000 (UTC) Received: (qmail 11243 invoked by uid 500); 10 Jan 2013 00:22:13 -0000 Delivered-To: apmail-struts-issues-archive@struts.apache.org Received: (qmail 11189 invoked by uid 500); 10 Jan 2013 00:22:13 -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 11082 invoked by uid 99); 10 Jan 2013 00:22:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Jan 2013 00:22:13 +0000 Date: Thu, 10 Jan 2013 00:22:13 +0000 (UTC) From: "Hudson (JIRA)" To: issues@struts.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (WW-2923) Allow validator parameters to be set via OGNL rather than hard coding in XML MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/WW-2923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13549227#comment-13549227 ] Hudson commented on WW-2923: ---------------------------- Integrated in Struts2-JDK6 #606 (See [https://builds.apache.org/job/Struts2-JDK6/606/]) WW-2923 adds support to be Locale independent (Revision 1431122) WW-2923 refactors validators to use dedicated params to define expressions (Revision 1431115) Result = SUCCESS lukaszlenart : Files : * /struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidatorTest.java lukaszlenart : Files : * /struts/struts2/trunk/core/src/main/resources/template/xhtml/form-close-validate.ftl * /struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleValidationAction-validation.xml * /struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-24.txt * /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/AbstractRangeValidator.java * /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidator.java * /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/DoubleRangeFieldValidator.java * /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/IntRangeFieldValidator.java * /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/LongRangeFieldValidator.java * /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/RegexFieldValidator.java * /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/ShortRangeFieldValidator.java * /struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/MockConfigurationProvider.java * /struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/DoubleRangeValidatorTest.java * /struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidatorTest.java * /struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/IntRangeFieldValidatorTest.java * /struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/LongRangeFieldValidatorTest.java * /struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/ShortRangeFieldValidatorTest.java > Allow validator parameters to be set via OGNL rather than hard coding in XML > ---------------------------------------------------------------------------- > > Key: WW-2923 > URL: https://issues.apache.org/jira/browse/WW-2923 > Project: Struts 2 > Issue Type: Improvement > Components: XML Validators > Affects Versions: 2.1.2 > Environment: Standard > Reporter: Scott Stanlick > Priority: Minor > Fix For: 2.3.9 > > > I have been experimenting with a softer way to perform validations. I like the idea of externalizing the validations in XML, however, it would be more flexible if the parameters could be "set" using matches from the ValueStack rather than requiring them to be hardcoded in the XML. I have drilled into the validator creation and believe that the ValidatorConfig.Builder(ValidatorConfig cfg) might be the place to check for $\{foo}. There are many other places in the framework where this string is searched for and its content replaced by using an OGNL search. > In my current use case, I am fetching valid ranges from a database according to user inputs. These varying integers are what I would like to use as my min and max values. I realize I could use an expression type validation or just code the validation inside my action. However, it doesn't seem natural to be forced into an alternative technique with the ValueStack being so central to the framework. It seems that if the value stack can be used for the validator message "Age must be between $\{min} and $\{max}" it should also be available for fetching constraints. > {code:xml} > > > ${minLimit} > ${maxLimit} > Age must be between ${minLimit} and ${maxLimit} > > > {code} > Peace, > Scott -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira