Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

double validation not catching text

 
K Dombroski
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to use the struts validator (using struts 1.2.7) to make sure the user enters a double value in a given range. When I enter a number outside the given range, I get the error as expected. But when I enter text, such as "hgl," I don't get any errors. "hgl" cannot be converted to a Double, so why is the validator not catching it? I am at a loss. If anyone can help, I'd be grateful.

Here is my validation:
<field property="financialFile.useTaxRate"
depends="double,doubleRange">
<arg0 key="Financial File: Use Tax Rate"
resource="false" />
<arg1 name="doubleRange" key="${var:min}" resource="false"/>
<arg2 name="doubleRange" key="${var:max}" resource="false"/>
<var>
<var-name>min</var-name>
<var-value>000.00</var-value>
</var>
<var>
<var-name>max</var-name>
<var-value>999.99</var-value>
</var>
</field>
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does your form look like? If you do not have your properties there defined as Strings then the validation framework cannot detect invalid entries.

- Brent
 
K Dombroski
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have useTaxRate defined as a double in my form. Will that not work?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic