I mistyped the compiler output. It should read: [javac] Found 2 syntax errors in ...: [javac] [javac] 36. mainForm.setProperty1("Dog"); [javac] <> [javac] [javac] *** Syntax: misplaced construct(s) [javac] [javac] [javac] [javac] 36. mainForm.setProperty1("Dog"); [javac] <---> [javac] [javac] *** Syntax: Unexpected symbol ignored
Phil > -----Original Message----- > From: HERSHKOWITZ,PHIL (A-Sonoma,ex1) > [mailto:[EMAIL PROTECTED]] > Sent: Friday, March 15, 2002 4:10 PM > To: 'Struts Users Mailing List' > Subject: RE: How to Pre-fill a formbean > > > Hi, > > In mainAction, where form is passed in by the method header, the code > > form.setProperty1("Dog"); > > compiles. > > In loginAction, the code: > > MainForm mainForm = new MainForm(); > mainForm.setProperty1("Dog"); > > as suggested by Viplava, fails to compile with: > > [javac] Found 2 syntax errors in ...: > [javac] > [javac] 36. mainForm.Property1("Dog"); > [javac] <> > [javac] > [javac] *** Syntax: misplaced construct(s) > [javac] > [javac] > [javac] > [javac] 36. mainForm.setProperty1("Dog"); > [javac] <---> > [javac] > [javac] *** Syntax: Unexpected symbol ignored > > > Am I missing something obvious in struts or am I missing > something obvious > about java (or more likely both :) What code do I have to include to > "trigger" struts to give me a reference to the formbean? > > Phil > > > > > > > -----Original Message----- > > From: Nekkalapudi, Viplava [mailto:[EMAIL PROTECTED]] > > Sent: Friday, March 15, 2002 12:14 PM > > To: 'Struts Users Mailing List' > > Subject: RE: How to Pre-fill a formbean > > > > > > > > // Create a form with the name given in struts-config.xml > > MainForm mainForm = new MainForm(); > > mainForm.setProperty1(..); > > ....... > > > > request.setAtribute("mainForm", mainForm); > > > > // **********************// > > > > Struts Action Servlet creates mainForm just before displaying > > the main.jsp, > > if it is not in the request/session. > > > > > > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED]] > > Sent: Friday, March 15, 2002 1:56 PM > > To: [EMAIL PROTECTED] > > Subject: RE: How to Pre-fill a formbean > > > > > > Hi All, > > > > And Thanks. So in my loginAction, I can create a reference to > > mainForm and > > pre-populate it with defaults from the database. > > > > Would someone be able to provide a snippet of code that I can use in > > loginAction to create a reference to mainForm? > > > > Thanks, > > Phil > > > > > > > -----Original Message----- > > > From: Jay sissom [mailto:[EMAIL PROTECTED]] > > > Sent: Friday, March 15, 2002 6:01 AM > > > To: Struts Users Mailing List > > > Subject: Re: How to Pre-fill a formbean > > > > > > > > > You can do it this way, but I would use a Struts tag instead > > > of a jsp tag. > > > Instead of using jsp:useBean and jsp:getProperty, all you > > > need to do is > > > > > > <bean:write name="mainForm" property="mfProperty"/> > > > > > > and that will write out the mfProperty to the JSP. > > > > > > Jay > > > > > > > > > On Thu, 14 Mar 2002, Joe Lee wrote: > > > > > > > Phil, > > > > > > > > Your loginAction should create and populate a mainForm > > > > bean and then saves it in the request scope. In the > > > > main.jsp, get a reference to this form by: > > > > <jsp:useBean name="mainForm" scope="request" > > > > class="com.MainForm"> > > > > and the input fields on that jsp get the defaults from > > > > this form bean. You have to use class (not type) so > > > > that if you come from a differene route to main.jsp > > > > rather than Login and the mainform bean may not be > > > > there already, a new one will be created for u. Then > > > > your jsp won't bombs and the input fields still get > > > > blank defaults. > > > > > > > > - Joe > > > > > > > > RE: How to Pre-fill a formbean > > > > > > > > > > > -------------------------------------------------------------- > > > ------------------ > > > > > > > > From: HERSHKOWITZ,PHIL (A-Sonoma,ex1) > > > > Subject: RE: How to Pre-fill a formbean > > > > Date: Thu, 14 Mar 2002 18:14:30 -0800 > > > > > > > > > > > -------------------------------------------------------------- > > > ------------------ > > > > > > > > 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 > > > > > > > > > > > > > > > > __________________________________________________ > > > > Do You Yahoo!? > > > > Yahoo! Sports - live college hoops coverage > > > > http://sports.yahoo.com/ > > > > > > > > -- > > > > 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]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>