Solved

Struts validator fails to validate locale-sensitive double values

Posted on 2009-07-08
1
371 Views
Last Modified: 2013-11-24
Looking for a way to use the Struts Validator to correctly validate user-entered double values, (which are really currency values), in a locale-sensitive way. Is this even possible? I have a form that is localized which allows users to enter a monetary amount. I want the Struts Validator to validate whether it is a valid value. Below is a snippet of my validation.xml file. If a user enters a value of 5.000,00 then the validation fails even though this is a valid amount in Greece for example.

I have set the user session locale appropriately, el_GR, prior to the call to validate.
<form name="myForm">
       	<field property="loanAmount" depends="required,double,doubleRange">
		<arg0 key="my.loanAmount"/>
		<var>
			<var-name>min</var-name>
			<var-value>0</var-value>
		</var>
		<var>
			<var-name>max</var-name>
			<var-value>999999</var-value>
		</var>
	</field>
</form>

Open in new window

0
Comment
Question by:brian-barnett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
brian-barnett earned 0 total points
ID: 24863060
Not sure what to add here to make it more understandable. I thought it was a thorough description. In the absence of response and being unable to find a solution myself, I opted to do the validation myself, outside of the validation provided by Struts validator. Darn :(
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question