You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dirk Behrendt <sc...@web.de> on 2003/09/16 16:58:16 UTC

How to fill textfields from FormBean?

Hello!

I have made a registration JSP (name, address, zip, ....) and I want
that the user can modify his account.

So I have an action class and a form bean for the registration. Now I
want to implement an action class which shows the registration JSP and
fills automatically the textfields with the stored values. The user can
change the values. 

How can I realize it? Is there a possibility to forward the values to
the JSP?

Dirk


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: How to fill textfields from FormBean?

Posted by Barry Volpe <st...@childrencare.com>.
Use the form bean in your action something like this:

public ActionForward execute(ActionMapping mapping,
ActionForm form, HttpServletRequest request,HttpServletResponse response)

throws IOException, ServletException {



RegForm form = null;

form = new RegForm();



//The following is an example, pull from your database to fill the text
field parameters.

form.setAddress("34 Road");

form.setName("Mike");

form.setZip("112343");


//Now foward to your form and your text fields will be populated.

Barry


----- Original Message ----- 
From: "Dirk Behrendt" <sc...@web.de>
To: <st...@jakarta.apache.org>
Sent: Tuesday, September 16, 2003 7:58 AM
Subject: How to fill textfields from FormBean?


> Hello!
>
> I have made a registration JSP (name, address, zip, ....) and I want
> that the user can modify his account.
>
> So I have an action class and a form bean for the registration. Now I
> want to implement an action class which shows the registration JSP and
> fills automatically the textfields with the stored values. The user can
> change the values.
>
> How can I realize it? Is there a possibility to forward the values to
> the JSP?
>
> Dirk
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: How to fill textfields from FormBean?

Posted by Andrew Hill <an...@gridnode.com>.
Yep. Your on the right track. Having populated your form in the action, it
will be forwarded along in a request attribute (or session depending on your
mapping) to the view jsp, where you can make use of the struts html tag
library (or jstl) to render the values in the fields. Like James say, your
first stop should be to go have a look at the example app. If you have any
questions about it do feel to post them :-)

-----Original Message-----
From: James [mailto:jmitchell@apache.org]
Sent: Tuesday, 16 September 2003 22:59
To: 'Struts Users Mailing List'
Subject: RE: How to fill textfields from FormBean?


Yes, take a look at how it is done in the struts-example application.

--
James Mitchell
Software Engineer / Struts Evangelist
http://www.struts-atlanta.org
678.910.8017
AIM:jmitchtx




> -----Original Message-----
> From: schnoerk@web.de [mailto:schnoerk@web.de]
> Sent: Tuesday, September 16, 2003 10:58 AM
> To: struts-user@jakarta.apache.org
> Subject: How to fill textfields from FormBean?
>
>
> Hello!
>
> I have made a registration JSP (name, address, zip, ....) and I want
> that the user can modify his account.
>
> So I have an action class and a form bean for the registration. Now I
> want to implement an action class which shows the registration JSP and
> fills automatically the textfields with the stored values.
> The user can
> change the values.
>
> How can I realize it? Is there a possibility to forward the values to
> the JSP?
>
> Dirk
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: How to fill textfields from FormBean?

Posted by James <jm...@apache.org>.
Yes, take a look at how it is done in the struts-example application.

--
James Mitchell
Software Engineer / Struts Evangelist
http://www.struts-atlanta.org
678.910.8017
AIM:jmitchtx




> -----Original Message-----
> From: schnoerk@web.de [mailto:schnoerk@web.de] 
> Sent: Tuesday, September 16, 2003 10:58 AM
> To: struts-user@jakarta.apache.org
> Subject: How to fill textfields from FormBean?
> 
> 
> Hello!
> 
> I have made a registration JSP (name, address, zip, ....) and I want
> that the user can modify his account.
> 
> So I have an action class and a form bean for the registration. Now I
> want to implement an action class which shows the registration JSP and
> fills automatically the textfields with the stored values. 
> The user can
> change the values. 
> 
> How can I realize it? Is there a possibility to forward the values to
> the JSP?
> 
> Dirk
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org