Ian Beaumont <[EMAIL PROTECTED]> writes:

> Ok - I want to select an item on one page which will take me to
> another page where I can edit the selected item.

Sounds common enough.

> How do I pre-populate the form for the edit page in the action for
> the selected item as the form won't exist at this point?

As long as you have the "name" attribute set correctly for the
appropriate <action> element of struts-config, the formbean will
always exist!  The controller servlet creates it for you.

-- Jim

> -----Original Message-----
> From: Jim Crossley [mailto:[EMAIL PROTECTED]]
> Sent: 20 February 2002 16:06
> To: Struts Users Mailing List
> Subject: Re: ActionForm and default values
> 
> 
> It's pretty simple, I think.  
> 
> 1) The formbean is passed to the action's perform method by the Struts
> controller.
> 
> 2) The action populates the formbean (ReportDataForm) from the value
> object (ReportData).
> 
> 3) The action returns the appropriate ActionForm to render the view.
> 
> 4) The view (ReportData.jsp) need look no more complicated than this:
> 
> <html:form action="/reportAction">
>   <html:text property="reportName"/>
> </html:form>
> 
> -- Jim
> 
> Ian Beaumont <[EMAIL PROTECTED]> writes:
> 
> > This question seems to be going around and around this mailing list
> and
> > no
> > one has produced an answer.
> > 
> > -----Original Message-----
> > From: Dua, Amit [mailto:[EMAIL PROTECTED]]
> > Sent: 20 February 2002 15:46
> > To: 'Struts Users Mailing List'
> > Cc: '[EMAIL PROTECTED]'
> > Subject: RE: ActionForm and default values
> > 
> > 
> > But then how will I set the default values
> > 
> > amit
> > 
> > -----Original Message-----
> > From: Keith [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, February 20, 2002 10:36 AM
> > To: Struts Users Mailing List
> > Subject: Re: ActionForm and default values
> > 
> > 
> > try removing the value= attribute from your <html: text.
> > hope that helps.
> > 
> > --- "Dua, Amit" <[EMAIL PROTECTED]> wrote:
> > > Hi 
> > > 
> > > I want to populate my page with default value 
> > > 
> > > So, in order to do that 
> > > I have a value object (ReportData), ReportDataForm (Form Bean)
> > > 
> > > I populate the Value object through one of the Action classes and
> then
> > do
> > a
> > > Action Forward to one of the Jsp namely ReportData.jsp
> > > 
> > > In the ReportData.jsp I do following 
> > > 
> > > ReportData reoportData =
> > (ReportData)request.getAttribute("reportdata"); 
> > > <html:form action="reportAction.do">
> > > <html:text property="reportName"
> > value="<%=reportData.getReportName()%>"/>
> > > ..................
> > > ..............
> > > 
> > > 
> > > I do all the validation In ReportAction class which is mapped to
> > > reportAction.do
> > > 
> > > But when there is an error In the field , I am not able to get the
> > value
> > > populated for the text field.
> > > 
> > > 
> > > Is there something wrong I am doing.
> > > Or is there any other better way of doing this thing..
> > > 
> > > 
> > > Amit
> > > 
> > > 
> > > --
> > > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > > 
> > 
> > 
> > =====
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > Search the archive:-
> > http://www.mail-archive.com/struts-user%40jakarta.apache.org/
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > Keith Bacon - Looking for struts work - South-East UK.
> > phone UK 07960 011275
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Sports - Coverage of the 2002 Olympic Games
> > 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]>

Reply via email to