You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Richards, Devin N (Devin)" <de...@lucent.com> on 2002/09/26 15:12:13 UTC

RE: initilaizing form bean values

Use the form's reset() method (as described in the docs and examples)

-Devin


-----Original Message-----
From: deepank [mailto:deepank@sasken.com]
Sent: Thursday, September 26, 2002 9:16 AM
To: Struts Users Mailing List
Subject: initilaizing form bean values


hi,

i have form bean for which i would like to initialize some fields with values before displaying the jsp.

for example if i have something like this in my jsp, how can i initialize this input field from my Action class with a value that i get from the database


<html:text property="mail_id" />, this should display some initial data

any help will be apprecaited

Deepank

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


Re: initilaizing form bean values

Posted by deepank <de...@sasken.com>.
I dont know how  this will help.
I have a form with several records, i have an edit buuton for each record.
If a user cliks the edit button i go back to the action class.
here i would like to pick up data from the database, this data i want to
display in the fields of the form(JSP) for the user to edit.
i have this code in the action as usual

if (mapping.getAttribute() != null) {
     if ("request".equals(mapping.getScope()))
      request.removeAttribute(mapping.getAttribute());
     else
      session.removeAttribute(mapping.getAttribute());
   }


this removes the previous form bean instance. SHOULD I REMOVE THIS CODE and
use setter methods to prepopulate the form bean fields
in the action class.

Deepank


----- Original Message -----
From: "Richards, Devin N (Devin)" <de...@lucent.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Thursday, September 26, 2002 6:42 PM
Subject: RE: initilaizing form bean values


> Use the form's reset() method (as described in the docs and examples)
>
> -Devin
>
>
> -----Original Message-----
> From: deepank [mailto:deepank@sasken.com]
> Sent: Thursday, September 26, 2002 9:16 AM
> To: Struts Users Mailing List
> Subject: initilaizing form bean values
>
>
> hi,
>
> i have form bean for which i would like to initialize some fields with
values before displaying the jsp.
>
> for example if i have something like this in my jsp, how can i initialize
this input field from my Action class with a value that i get from the
database
>
>
> <html:text property="mail_id" />, this should display some initial data
>
> any help will be apprecaited
>
> Deepank
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


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