Apache Struts 2 Documentation > Home > Guides > Core Developers Guide > Validation > double validator
Added by James Holmes, last edited by James Holmes on Aug 15, 2007

Description

Field Validator that checks if the double specified is within a certain range.

Parameters

  • fieldName - The field name this validator is validating. Required if using in-Validator Syntax otherwise not required
  • minInclusive - the minimum inclusive value in FloatValue format specified by Java language (if none is specified, it will be checked)
  • maxInclusive - the maximum inclusive value in FloatValue format specified by Java language (if none is specified, it will be checked)
  • minExclusive - the minimum exclusive value in FloatValue format specified by Java language (if none is specified, it will be checked)
  • maxExclusive - the maximum exclusive value in FloatValue format specified by Java language (if none is specified, it will be checked)

Examples

                <validators>
          <!-- Plain Validator Syntax -->
          <validator type="double">
              <param name="fieldName">percentage</param>
              <param name="minInclusive">20.1</param>
              <param name="maxInclusive">50.1</param>
              <message>Age needs to be between ${minInclusive} and
axInclusive} (inclusive)</message>
          </validator>

          <!-- Field Validator Syntax -->
          <field name="percentage">
              <field-validator type="double">
                  <param name="minExclusive">0.123</param>
                  <param name="maxExclusive">99.98</param>
                  <message>Percentage needs to be between ${minExclusive}
 ${maxExclusive} (exclusive)</message>
              </field-validator>
          </field>
     </validators>