Hi Jay, And Thanks. But if I understand struts correctly, the form you are casting from is loginForm.
My struts-config.xml looks like: <form-beans> <form-bean name="mainForm" type="com.mainForm"/> <form-bean name="loginForm" type="com.loginForm"/> </form-beans> <action input="/login.jsp" name="loginForm" path="/login" type="com.loginAction" /> <action input="/main.jsp" name="mainForm" path="/mainAction" type="com.mainAction" /> So the form in public ActionForward perform(ActionMapping mapping, ActionForm form, ... is loginForm. I need a reference to mainForm. Thanks, Phil > -----Original Message----- > From: Jay sissom [mailto:[EMAIL PROTECTED]] > Sent: Thursday, March 14, 2002 6: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]>