Okay, Michael. If this is what you like, good luck. I am stopping the conversation from my side if it is staying at this level.
On 5/23/05, Michael Jouravlev <[EMAIL PROTECTED]> wrote: > > > JSPs "fetch" data indeed is putting application logic in the JSPs. > > > This does not give you flexibility. Quite the opposite, it ties your > > > model and you view down by coupling them. Rather than give you > > > flexibility it hamstrings you. > > So what? These two will always be related unless you use simple > meaningless DTOs with no relation to business objects. I personally do > not use this type of DTO, I prefer to use real business objects in the > view. I don't care that it ties view to the model. But at least I get > readable, understandable code and I get business rules. Oh, right, I > use business objects for input too, in this example they are used > solely for output... But Laurie said, that it is not a real business > object, it is just a "view object", so view is actually not tied that > tight to the model. > > > Consider a comercial > > product implemented on Struts and JSPs. You build the product and ship > > it to customers. You don't ship the source code -- that's proprietary -- > > but you do ship the JSPs and you want the customers to be able to > > locally customize the application. > > You do realize, that JSP _is_ a part of app source code, do you? And > the more you put into JSP, the more this supposedly dumb JSP page will > look like "real code"? If you ship without source code, you'd rather > precompile the JSPs. > > Now, to your problem. I will try to think right while I am typing. > First of all, I haven't actually used dynaforms, so no advices here. > Now, you want your input to go to action form? Why? Apparently, > because you want Struts to parse request data, and to perform > automatic validation. OK. So you need to associate form bean with > every incoming request, but you do not want to redefine form beans, > hence dynaform. > > Struts uses getters and setters to put values into the form (at least > if it is not a dynamic form), so you can use getters and setters to > direct where the data goes... I am not sure how do you do this with > dynabean, but with regular bean you would have your getter pulling > data from your view object, and the setter storing data in the form > field. Then, after validation, you would type-convert and copy values > from form fields to your view object. > > Or... you can still pull data from your view object and display values > using bean:write. But the tags themselves will have "property" > pointing to the form bean. I am not sure how this will work, but if > you were able to print values from view object, and submit them to the > form bean, then you'd just copy them to view object, and _then_ > validate them. Then, if needed, you would redisplay data again from > the view object, which contains updated data (possibly incorrect, but > who cares, this view object is a _copy_ of a real object anyway, > right?). In this case you do not need getters in the form bean. > Because there are no getters, this "pull from view object, submit to > action form" might work. I have not really tried it. > > Michael. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- "You can lead a horse to water but you cannot make it float on its back." ~Dakota Jack~ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]