So you preload a formbean in an Action just not in the Action associated
directly with the form bean?

-----Original Message-----
From: HERSHKOWITZ,PHIL (A-Sonoma,ex1)
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 14, 2002 9:32 PM
To: 'Struts Users Mailing List'
Subject: RE: How to Pre-fill a formbean


Hi,

>From the loginAction, I am calling the database to retrieve default values
for some of the fields the use must fill out on mainAction.jsp. The default
values depend on the user ID.

Phil


> -----Original Message-----
> From: John Menke [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 14, 2002 6:28 PM
> To: Struts Users Mailing List
> Subject: RE: How to Pre-fill a formbean
>
>
> How do you know what record in the database this will
> retrieve?  Where does
> it get it's data.  the form bean that is instantiated will be
> empty unless
> you put data into it correct?
>
> -----Original Message-----
> From: Jay sissom [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 14, 2002 9:12 PM
> To: Struts Users Mailing List
> Subject: Re: How to Pre-fill a formbean
>
>
> The form bean has already been created by the time your
> mainAction perform
> method is called if you have defined the form bean in your
> struts-config.xml file.
>
> All you would do is this:
>
> mainForm mf = (mainForm)form;
> // where form is passed to the perform method
>
> mf.setProperty1("asdfasdf");
> mf.setProperty2("asdffdf");
> mf.setProperty3("asdfasdf");
>
> Then in the JSP that you forward to, you can use
> <bean:write/> to write
> out the properties from the bean.
>
> Jay
>
> On Thu, 14 Mar 2002 [EMAIL PROTECTED] wrote:
>
> > Hi,
> >
> > My jsp application begins at a login page.
> >
> > I call the login page action loginAction and I have defined
> loginForm to
> > process the user details.
> >
> > If the login is successful, the action forwards to
> mainAction.jsp, whose
> > form action is /mainAction
> >
> > Before I display the mainAction.jsp I want to pre-load some
> form values
> from
> > the java code that processes the login action
> (loginAction.java) by using
> > the Set methods of mainForm.
> >
> > Is the best way to do this to get a reference to the not-yet-created
> > mainForm bean? If so, would someone give a code snippet
> showing how to
> refer
> > to a bean that is not the struts form bean for the loginAction?
> >
> > Or is there a better way to do this?
> >
> > Thanks,
> > Phil
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to