> -----Original Message-----
> From: Jen [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 30, 2004 7:47 AM
> To: [EMAIL PROTECTED]
> Subject: RE: newbie question: form initialization and process, 
> 
> 
> >> Hi, 
> >> I am new to Struts and after browsered the nightly
> >> build example app, found it did different way with
> >> what I have.
> >> In example app the forms's initial display action
> is
> >> different from the form's submit action. 
> 
> 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 :)  

> 
> >This is somewhat typical. 
> ShowFormAction->form.jsp->SubmitFormAction.
> 
> >> what if after
> >> the form submission, it needs to forward to a jsp
> > which is form too, where can I do the initial work
> for
> >> the second jsp? 
> 
> >Not sure what you mean here, but if I understand you
> >correctly, you don't do work in 
> >jsps.
> 
> >>For mine, every page will need some
> >> sort of initialization, and then the page is
> submitted
> >> to itself and do the process. 
> 
> >Nope, no submitting to itself in struts land :)  
> >All processing is done in actions.  
> 
> >> Second, my form all have confirm page, that is
> after
> >> the form submitted, goesto a page show all the
> >> inofrmation user just entered, and it have edit and
> >> submit button, does this page needs a form too? 
> 
> >What you're looking for is:
> >ShowFormAction->form.jsp->SubmitAction->confirmation.jsp->Fin
> alSubmitAction->some.jsp
> >If you don't want to do this in two actions, you can
> >include a hidden field in the 
> >form to indicate that
> >the form has/has not been verified, and have the
> >submit action check for that and do 
> >things appropriately.
> 
> >No, no separate form bean.
> 
> For my case, the confirmation.jsp is not really form,
> it just shows all the information in text, ie, no
> input text box, only text; no selection list, only
> show waht user selected. 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.

> 
> >>what
> >> action should the eidt button go?
> 
> >Back to the ShowFormAction is probably best,
> >although you could go back to the 
> >form.jsp page.
> 
> >> Thanks
> 
> >You're welcome, hth.
> 
> 
> 
>               
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - 50x more storage than other providers!
> http://promotions.yahoo.com/new_mail
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

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

Reply via email to