You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Struts <te...@dilshener.de> on 2003/07/23 15:34:10 UTC

prefill form bean ahead of the jsp

Hi all
Can I prefill the values of my form bean ahead of displaying the jsp page
that is associated with this form?
If yes, how?

I am trying not to override the values entered by the user on this result
page.
Because when an error occurs the page is redisplayed and since I am getting
the values from an object that I store in the session,
the fields are reset back to their original values.

Thanks
Tex...





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


Re: prefill form bean ahead of the jsp

Posted by Struts <te...@dilshener.de>.
Found it.
The struts frame work was not finding all the classes required to create the
form bean so it was giving me a null value instead of throwing an exception.
"Rick Reumann" <r...@reumann.net> schrieb im Newsbeitrag
news:20030723102353.5873b395.r@reumann.net...
> On Wed, Jul 23,'03 (03:34 PM GMT+0200), Struts wrote:
>
> > Hi all
> > Can I prefill the values of my form bean ahead of displaying the jsp
> > page that is associated with this form?
> > If yes, how?
>
> Sure just do it in Action before you go the form or if you know they
> will always be the same values you can set them as default or intial
> values in your ActionForm/DynaActionForm.
>
> > I am trying not to override the values entered by the user on this
> > result page.
> > Because when an error occurs the page is redisplayed and since I am
> > getting the values from an object that I store in the session,
> > the fields are reset back to their original values.
>
> You definitely should be populating your form on the JSP from values in
> Session (well, the exception would be select options lists). I like to
> set up certain intial form values in a setUp dispatch or regular
> SetUpAction since the setUp is often based on 'who' is logged in.
>
> There's a real basic example in lesson 1 here http://www.reumann.net/
>
> --
> Rick




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


Re: prefill form bean ahead of the jsp

Posted by Rick Reumann <r...@reumann.net>.
On Wed, Jul 23,'03 (03:34 PM GMT+0200), Struts wrote: 

> Hi all
> Can I prefill the values of my form bean ahead of displaying the jsp
> page that is associated with this form?
> If yes, how?

Sure just do it in Action before you go the form or if you know they
will always be the same values you can set them as default or intial
values in your ActionForm/DynaActionForm.

> I am trying not to override the values entered by the user on this
> result page.
> Because when an error occurs the page is redisplayed and since I am
> getting the values from an object that I store in the session,
> the fields are reset back to their original values.

You definitely should be populating your form on the JSP from values in
Session (well, the exception would be select options lists). I like to
set up certain intial form values in a setUp dispatch or regular
SetUpAction since the setUp is often based on 'who' is logged in.

There's a real basic example in lesson 1 here http://www.reumann.net/

-- 
Rick

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


Re: prefill form bean ahead of the jsp

Posted by Struts <te...@dilshener.de>.
Found it.
The struts frame work was not finding all the classes required to create the
form bean so it was giving me a null value instead of throwing an exception.
"Struts" <te...@dilshener.de> schrieb im Newsbeitrag
news:bfostd$5c7$1@localhost.localdomain...
> Thanks
> I am actually doing as per example, but in my action class the form is
null
> !!!
> I mean it does not seem to create an instance of the associated form and
> pass it into the execute().
>
> Any ideas to what I am doing wrong?
>
> Tex...
>
> "Cecile Mercado" <ce...@radianse.com> schrieb im Newsbeitrag
> news:003101c35127$ec0a53a0$c901a8c0@CECEILSDESKTOP...
> > Check out http://jakarta.apache.org/struts/faqs/newbie.html#prepopulate
> >
> > - Cecile
> >
> > -----Original Message-----
> > From: Struts [mailto:tezcan@dilshener.de]
> > Sent: Wednesday, July 23, 2003 9:34 AM
> > To: struts-user@jakarta.apache.org
> > Subject: prefill form bean ahead of the jsp
> >
> >
> > Hi all
> > Can I prefill the values of my form bean ahead of displaying the jsp
page
> > that is associated with this form?
> > If yes, how?
> >
> > I am trying not to override the values entered by the user on this
result
> > page.
> > Because when an error occurs the page is redisplayed and since I am
> getting
> > the values from an object that I store in the session,
> > the fields are reset back to their original values.
> >
> > Thanks
> > Tex...
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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: prefill form bean ahead of the jsp

Posted by Struts <te...@dilshener.de>.
Thanks
I am actually doing as per example, but in my action class the form is null
!!!
I mean it does not seem to create an instance of the associated form and
pass it into the execute().

Any ideas to what I am doing wrong?

Tex...

"Cecile Mercado" <ce...@radianse.com> schrieb im Newsbeitrag
news:003101c35127$ec0a53a0$c901a8c0@CECEILSDESKTOP...
> Check out http://jakarta.apache.org/struts/faqs/newbie.html#prepopulate
>
> - Cecile
>
> -----Original Message-----
> From: Struts [mailto:tezcan@dilshener.de]
> Sent: Wednesday, July 23, 2003 9:34 AM
> To: struts-user@jakarta.apache.org
> Subject: prefill form bean ahead of the jsp
>
>
> Hi all
> Can I prefill the values of my form bean ahead of displaying the jsp page
> that is associated with this form?
> If yes, how?
>
> I am trying not to override the values entered by the user on this result
> page.
> Because when an error occurs the page is redisplayed and since I am
getting
> the values from an object that I store in the session,
> the fields are reset back to their original values.
>
> Thanks
> Tex...
>
>
>
>
>
> ---------------------------------------------------------------------
> 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: prefill form bean ahead of the jsp

Posted by Cecile Mercado <ce...@radianse.com>.
Check out http://jakarta.apache.org/struts/faqs/newbie.html#prepopulate

- Cecile

-----Original Message-----
From: Struts [mailto:tezcan@dilshener.de]
Sent: Wednesday, July 23, 2003 9:34 AM
To: struts-user@jakarta.apache.org
Subject: prefill form bean ahead of the jsp


Hi all
Can I prefill the values of my form bean ahead of displaying the jsp page
that is associated with this form?
If yes, how?

I am trying not to override the values entered by the user on this result
page.
Because when an error occurs the page is redisplayed and since I am getting
the values from an object that I store in the session,
the fields are reset back to their original values.

Thanks
Tex...





---------------------------------------------------------------------
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