You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Samuel Cheung <SC...@Novarra.com> on 2005/03/21 18:38:13 UTC
How can I bind the value of a TextField to an int property of my JavaBean
Hi,
Can someone please tell me How can I bind the value of a TextField to an
int property of my JavaBean?
I have set/get method for height (an int) of my JavaBean profile.
I try this, does not work, I got a cast exception when I try to get the
value:
<input type="text" jwcid= "@TextField" value="profile.height"
size="10"/>
I try this, but this does not work either. It won't work when I try to
set the value of the textfield.
<input type="text" jwcid= "@TextField" value="
@java.lang.Integer@toString(profile.height) size="10"/>
What is the best way to solve this? I have an idea of writing a separate
set/get to convert int to String. But since I have a lot of properties
in 'int' , I will have to write a lot of this set/get functions.
Please let me know if you have a better idea.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: How can I bind the value of a TextField to an int property of my JavaBean
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Sadly, you'll have to use ValidField for this. TextField can only bind
to a String.
Erik
On Mar 21, 2005, at 12:38 PM, Samuel Cheung wrote:
>
> Hi,
>
> Can someone please tell me How can I bind the value of a TextField to
> an
> int property of my JavaBean?
>
> I have set/get method for height (an int) of my JavaBean profile.
>
> I try this, does not work, I got a cast exception when I try to get the
> value:
> <input type="text" jwcid= "@TextField" value="profile.height"
> size="10"/>
>
>
> I try this, but this does not work either. It won't work when I try to
> set the value of the textfield.
> <input type="text" jwcid= "@TextField" value="
> @java.lang.Integer@toString(profile.height) size="10"/>
>
> What is the best way to solve this? I have an idea of writing a
> separate
> set/get to convert int to String. But since I have a lot of properties
> in 'int' , I will have to write a lot of this set/get functions.
>
> Please let me know if you have a better idea.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org