Solved

Struts validator fails to validate locale-sensitive double values

Posted on 2009-07-08
1
370 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
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Application launch issue with Apache Tomcat 5 64
Weekend adv creator 3 54
jmss example java 2 24
ejb message driven bean mdb creation steps 2 24
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

830 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