Solved

Struts validator fails to validate locale-sensitive double values

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now