You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mikkel Bruun <mi...@valtech.dk> on 2001/05/16 20:16:06 UTC

RE: Populating HTML text field value property with a Bean propert y.

Hi Mohan,

Well you almost got it...

Consider this example,

<html:text name="emp" property="emp_id" size="10" value="" maxlength="10"/>

It will populate the text field with the emp_id property from the bean
called emp. Basically emp.getEmp_id()
Emp can be a bean in any scope, eg page, application, session or request...

hope this helps??

Mikkel Bruun
 

-----Original Message-----
From: Mohan_Venkataraman@infinium.com
To: struts-user@jakarta.apache.org
Sent: 16-05-2001 16:38
Subject: Populating HTML text field value property with a Bean property.

Hi,
I am a new Struts user and am not sure as to how to populate a struts
HTML
text field's value property with the property of a bean without
manipulating it in ActionForm.
For example i need to initialize the value with a bean's property.

<html:text property="emp_id" size="10" value="" maxlength="10"/>

Thanks in advance.

Mohan Venkataraman.

Re: Populating HTML text field value property with a Bean property.

Posted by Eric Rasmussen <er...@websidestory.com>.
No.  Your problem is 'value=""'.  This will set the value to empty string no
matter what the bean's value was.  It overrides it, in other words.

If you want the value pulled from the form bean passed in, remove the value
attribute and it should work.

    - eric

----- Original Message -----
From: "Mikkel Bruun" <mi...@valtech.dk>
To: <Mo...@infinium.com>; <st...@jakarta.apache.org>
Sent: Wednesday, May 16, 2001 11:16 AM
Subject: RE: Populating HTML text field value property with a Bean property.


> Hi Mohan,
>
> Well you almost got it...
>
> Consider this example,
>
> <html:text name="emp" property="emp_id" size="10" value=""
maxlength="10"/>
>
> It will populate the text field with the emp_id property from the bean
> called emp. Basically emp.getEmp_id()
> Emp can be a bean in any scope, eg page, application, session or
request...
>
> hope this helps??
>
> Mikkel Bruun
>
>
> -----Original Message-----
> From: Mohan_Venkataraman@infinium.com
> To: struts-user@jakarta.apache.org
> Sent: 16-05-2001 16:38
> Subject: Populating HTML text field value property with a Bean property.
>
> Hi,
> I am a new Struts user and am not sure as to how to populate a struts
> HTML
> text field's value property with the property of a bean without
> manipulating it in ActionForm.
> For example i need to initialize the value with a bean's property.
>
> <html:text property="emp_id" size="10" value="" maxlength="10"/>
>
> Thanks in advance.
>
> Mohan Venkataraman.
>