Subject: Re: FormBeans ... as an Interface. From: "Vic C." <[EMAIL PROTECTED]> === We can solve the tech issues, if architecture makes sense as an altertive. Techonlogy should not be just for the sake of technology. The position last was that it is leightweight and people could apply it as they see fit. Please just keep the option open and not "over my dead body". V.
Craig R. McClanahan wrote: > > On Thu, 13 Jun 2002, John Yu wrote: > > >>Date: Thu, 13 Jun 2002 17:18:31 +0800 >>From: John Yu <[EMAIL PROTECTED]> >>Reply-To: Struts Developers List <[EMAIL PROTECTED]> >>To: Struts Developers List <[EMAIL PROTECTED]> >>Subject: RE: FormBeans ... as an Interface. >> >>At 09:54 pm 12-06-2002 -0700, you wrote: >> >>>Quite frankly, it baffles me when people want to use form beans as the >>>model. Doing this couples the model to the view in wholly undesirable ways. >>> >>>For instance, what happens when the UI designer moves things around in the >>>pages in such a way that the mappings between UI elements and pages (and >>>thus form beans) change? It seems that you'd have to change the model now, >>>just because the UI designer made some tweaks to the view. This kind of >>>coupling is entirely unacceptable in anything other than trivial apps. >> >> >>Not dispute about this. But, you can view it from the other angle: >> >>In my case, I want to use something from the model as the formbeans, not >>the other way round (as we all know having a model->view dependency is >>bad). However, because of the way formbean is designed in Struts, this ends >>up having the ActionForm class and the other dependent apis dragged into >>the model tier. >> >>So, to paraphrase my question: "Does it make sense to modify Struts such >>that it allows other objects (e.g. from the model tier) to participate the >>role of formbeans but does not create an ugly model->view dependency?" >> >>(The situation is like in Swing, a model object can implement a Listener >>interface and let the view components talk to them. This isn't regarded as >>a model->view coupling.) >> > > > Consider an integer property of your model bean, which you are going to > render as a text field due to the limitations of HTML. Consider a user > that types in "1a3" instead of "123", and thus causes a conversion error > when Struts attempts to store the property value. How do you plan to meet > the user's expectation, when the page is redisplayed, of showing what he > or she *did* type so that it can be corrected? > > The preferred answer in Struts is to use a String property in your form > bean for this purpose -- conversion to the underlying model data types > should be triggered by the Action, after validation has been completed and > any business-layer checks have been performed. > > Form beans have different purposes, different semantics, and different > lifetimes than model objects. > > >>-- >>John Yu Scioworks Technologies >>e: [EMAIL PROTECTED] w: +(65) 873 5989 >>w: http://www.scioworks.com m: +(65) 9782 9610 >> >>Scioworks Camino - "Rapid WebApp Assembly for Struts" >> > > > Craig > > > -- > 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]>