Subject: Re: Form validation
From: Vic C <[EMAIL PROTECTED]>
 ===
It is a good practice to make all getters and setters take strings as 
arguments and return strings. HTTP is string based. Even on Int or Dates 
or whatever.
The tricky part is that internaly they are implemented using native data 
types like BigDecimal or SQLDateTime (and persisted in a Disconnected 
RowSet for example). You immplement convert Strings to real data types 
within the getter if it works or store the wrong answer for a bit.
Was that confusing? getters and setters use only string, but inside the 
bean they are implemented using db native types.
(OT: and you can even format in the getter (with commans/decimals), 
localize dates, etc.)
And on a related topic:
Of course if you turn on the client side validation, JavaScript will be 
automaticaly generated to create a pop up Window (you code nothing other 
than place the JavaScript tag) on a submit to validate a date, #, reg. 
expression, CreditCard checksum, etc.

Vic

(Guess where is there an example of doing this?)

Jivan, Rajiv wrote:
> I have a jsp which has an input field in which the user is supposed to enter only 
>integers.
> The form bean has a field of type int which is displayed as the default in the input 
>field using <html:text ...>
> When the user submits the form I want to validate the input field and make sure its 
>a number. The problem is that if it isn't a number when I display an error message 
>the original content which was entered in the field is lost as it reflects the data 
>in the form bean which is an integer.
> Is there is way to preserve it?
> 
> 
> 
> -----Original Message-----
> From: Galbreath, Mark [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 23, 2002 3:07 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Need help with Token stuff - URGENT
> 
> 
> Reid's still in jail.
> 
> -----Original Message-----
> From: JM [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 23, 2002 3:08 PM
> To: Struts Users Mailing List
> Subject: RE: Need help with Token stuff - URGENT
> 
> 
> I promise....its not me.  Is that you Reid????
> 
> JM
> 
> 
>>-----Original Message-----
>>From: Galbreath, Mark [mailto:[EMAIL PROTECTED]]
>>Sent: Thursday, May 23, 2002 2:46 PM
>>To: 'Struts Users Mailing List'
>>Subject: RE: Need help with Token stuff - URGENT
>>
>>
>>Good lord!  This sounds like one of James's joke questions to the list....
>>
>>[EMAIL PROTECTED] wrote:
>>
>>>Hello guys,
>>>
>>>I still can't work with token stuff.
>>>
>>>If I have a JSP page with a menu, and when the user clicks in one
>>>option, it goes to another menu, which has a html:form and a submit
>>>button with an action associated. Where should I use the token
>>>associated methods ? where/when should I call saveToken ?
>>>
>>>thanks a lot
>>>Jefferson
>>
>>--
>>To unsubscribe, e-mail:
>><mailto:[EMAIL PROTECTED]>
>>For additional commands, e-mail:
>><mailto:[EMAIL PROTECTED]>
>>
>>
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 


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

Reply via email to