> -----Original Message-----
> From: Jen [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 30, 2004 3:39 PM
> To: Struts Users Mailing List
> Subject: RE: newbie question: form initialization and process, 
> 
> 
> > > 
> > > What I want to say is normally SubmitFormAction
> > will
> > > return a jsp page, but this returned jsp
> > page(let's
> > > call it form2.jsp) also needs initialize, so route
> > > will be:
> > >
> >
> ShowFormAction->form.jsp->SubmitFormAction->ShowForm2Action->f
> > > or2.jsp->SubmitForm2Action
> > > so every submit action will return an action
> > instead
> > > of a jsp page. potentially the number of actions
> > > double the number of form jsps. what I do in my
> > own
> > > models, my handler handles both initialize and
> > > process.
> > 
> > That works to :)  
> > 
>  
> Is there a better alternative?

Not really.  Some people will tell you it's better to have one action per action 
class, but Struts does 
provide the class structure to do that.

> 
> > > I guess I have to make the form to be session
> scope?
> > 
> > No not necessarily.  You could put the form bean in
> > request scope in the submit action, and then 
> > display that.  However, it might be better to go
> > ahead and extract your model bean from the form bean
> > in the submit action, and then put the model bean
> > into session scope and disply there.  That will
> > provide you a better way to seperate the UI from the
> > data I think.  It will also make it easier to format
> > field nicely etc.  The problem is if the user
> > decides to change something, then you have to push
> > the model back into the form and resdisplay.
> > I would also, in the confirmation action, null out
> > the session scope attribute you've created since
> > you're done with it.
> > 
> I my case there is an Edit button on confirm page. If
> I set the form bean be request scope, when the Edit
> button pressed, there is no actual form, how can I
> populate the data again?
> I like the Struts form bean idea just because it
> doesn't interfer with model bean, I only save to model
> bean if the user finally clicked confirm.

That's MVC architecture, not just struts... any MVC framework would provide that for 
you.
Makes changing things very easy.

> 
> Thanks

Your welcome

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

Reply via email to