Re: major headaches:)
Vic Cekvenich <[email protected]> Fri, 30 May 2003 15:48:06 -0400
| Newsgroups | gmane.comp.java.mvc.devel |
|---|---|
| Organization | baseBeans Engineering |
| Message-ID | <[email protected]> |
Rick Reumann wrote: >On Fri, 30 May 2003 12:55:26 -0400, Vic Cekvenich wrote: > > > >>Nvigation and presentation have nothing to do with form beans. >> >> > >Only sometimes the above statement is true. > Lets agree to disagree. In layer (MVC) development, you can develop one layer first. .V > Navigation often does have to > > >take form beans into consideration (more precisely request parameters) >when you forward from one Action to another Action since the request is >passed from one Action to the next. So for example imagine a form bean >and JSP form with the properties: > >"title" >"description" > >Now you submit which populates your form bean in scope (say BeanFoo) but >when you are done doing your stuff you forward to another Action... > ><forward name="Saved" >path="/do/SomeOtherAction?Dispatch=DisplayDetail" /> > >and this new Action has a different form bean associated with it (say >BeanBar) and BeanBar has similar properties "title" "description" you will end >up populating BeanBar with the title and description properties that were >entered back on the JSP form on the other page. > >See the problem? So I think it is wrong to say that Navigation does not >have to take form beans into consideration if you plan on passing requests >around by forwarding to other Actions. > >Possibly you never noticed this problem since your beans always have been >fortunate enough to have unique field names (relative to other beans)- but >this can not always be guaranteed - nor should it have to be. > > >Another example, as I've mentioned is a search where you use a SearchBean. >When you eventually forward to your DisplayAction that Action 'DOES' need >to be aware of the possibility of a SearchBean in scope so that it can >pull parameters from it that will be used in this new bean's "populate" >method. > >So this idea of "one form" "one form bean" "one action" begins to take >some more thought when you end up forwarding the request to another >action. > > >Trust me I'm not trying to over-design and I'm all about MVC and I'm >definitely not trying to take short cuts.. it's just that you can't just >assume all the Action classes can be independent and do not have to >concern themselves with other form beans. When you go from one Action and >forward to a JSP - yes you are correct. But when you go from one Action >and forward ton another Action, you do need to often be aware of the >consequences of what was done in the previous Action you just left. > > > > -- Vic Cekvenich, Struts Instructor, 1-800-917-JAVA Advanced <a href ="baseBeans.com">Struts Training</a> and project recovery in North East. Open Source <a href ="baseBeans.com">Content Management</a> basicPortal sofware Best practice<a href ="baseBeans.com">Struts Support</a> v.1.1 helper ScafflodingXPress