No. Not when the user enters a string with commas.
So we are thinking of switching to Strings instead of longs then manually 
convert, but I was hoping for something more automatic.

--------------------
Mick Knutson
Wells Fargo Business Direct
(415) 222-1020

"This message may contain confidential and/or privileged information. If you 
are not the addressee or authorized to receive this for the addressee, you must 
not use, copy, disclose, or take any action based on this message or any 
information herein. If you have received this message in error, please advise 
the sender immediately by reply e-mail and delete this message. Thank you for 
your cooperation."
--------------------



-----Original Message-----
From: Wendy Smoak [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 16, 2004 2:52 PM
To: Struts Users Mailing List
Subject: Re: String with digits to Long, verse String w/ digits and
commas to Long


From: <[EMAIL PROTECTED]>
> I have a form field that I want to be a number in the DB,
> but the user can add digits, or digits with commas into.
> So 1000 is the same at 1,000 on the ui.
> My question is, will struts convert "1,000" to 1000L
> just as it will convert "1000" to 1000L?

Struts doesn't do conversions-- BeanUtils (a Jakarta Commons project) does.
Use a String in the Form itself, that way you can validate and re-display
incorrect data.  Then use BeanUtils to copy the data from the form to some
object that you hand to the database.   If BeanUtils doesn't convert the way
you want it to, you can write your own Converter and register it.

Does a number with commas pass validation for a long?

-- 
Wendy Smoak


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to