You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ko...@ubsw.com on 2002/05/23 19:14:14 UTC

form bean variable type conversions

Hi,

Quick question: if I have a html:text element in a JSP, can I map it to form bean variable of type int, expecting an automatic type conversion from String to int, or must all form bean variables be of type String?

Cheers,

Kosh 

Re: form bean variable type conversions

Posted by Ted Husted <hu...@apache.org>.
It will convert fine, so long as you have both clever and kind users who
never enter letters in a numeric field. 

ActionForms are character buffers for the HTML elements. Once the data
is collected and validated, then you should convert and/or transform it. 

But since HTML and HTTP are string based, so should your ActionForms be.

-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-- Web: http://husted.com/about/services


Kosh.Podder@ubsw.com wrote:
> 
> Hi,
> 
> Quick question: if I have a html:text element in a JSP, can I map it to form bean variable of type int, expecting an automatic type conversion from String to int, or must all form bean variables be of type String?
> 
> Cheers,
> 
> Kosh

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>