struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Affan Qureshi" <quere...@etilize.com>
Subject Re: Duplication of code in Business objects and Action forms
Date Tue, 22 Oct 2002 10:44:24 GMT
Do you intend to pass the Data Object back and forth between the
presentation layer and the Business layer? I thought it would be a nice idea
to pass only the view of the data in/out of the Business layer and the
presentation layer.

I would go more for what Ronald specified.

----- Original Message -----
From: "Rajesh Kanade" <rkanade@bigates.com>
To: "'Struts Users Mailing List'" <struts-user@jakarta.apache.org>
Sent: Tuesday, October 22, 2002 3:25 AM
Subject: RE: Duplication of code in Business objects and Action forms


> Thanx Ronald for the reply.
>
> One solution which I have thought of is
>
> I have a data object let's say called UserData which has all the
> instance variables and getter/setter methods.
>
> Now both User Form and User Business object have a instance variable of
> this UserData object which they use.
> This way if my data is changing I just have to change it at one place
> i.e. my UserData class.
>
> Are we both essentially talking the same thing ??
>
> Thanx
>
> Rajesh
>
> -----Original Message-----
> From: Ronald Rotteveel [mailto:r.p.rotteveel@its.tudelft.nl]
> Sent: Tuesday, October 22, 2002 3:44 PM
> To: Struts Users Mailing List
> Subject: Re: Duplication of code in Business objects and Action forms
>
>
> I'm not using Struts for a very long time now, but I think this is NOT
> the way to do this.
>
> In your ActionForm bean called User I would put the getter/setter
> methods. In your UserBO (User Business Object) I would put the methods
> that make use of the UserDAO (User Data Access Object). The UserBO is
> only for handling the business logic in your form/application. The
> UserDAO actually executes the real SQL queries or XML update functions.
>
> So, User extends ActionForm and is really a simple mapping of your form
> in your application.
>
> In your Action class (belonging to this User form) you map the User bean
> and give it as an argument with any function of your UserBO object which
> will execute the desired action (update/create/delete etc.).
>
> Hope I helped you a bit. Maybe other people have better solutions, but
> this is the way I handle actions.......
>
> Good luck........
>
> Regards,
>
> Ronald
>
>
> ----- Original Message -----
> From: "Rajesh Kanade" <rkanade@bigates.com>
> To: "'Struts Users Mailing List'" <struts-user@jakarta.apache.org>
> Sent: Tuesday, October 22, 2002 9:00 AM
> Subject: Duplication of code in Business objects and Action forms
>
>
> > Hi All
> >
> > I am new to Struts so please bear with me.
> >
> > We have started implementing a new  product using struts.
> >
> > Now I do see that I need to have getter /setter methods declared on
> > both
> my
> > business objects as well as Action form.
> > So for e.g if I had a User business object which encapsulates the
> > entire business login for my system user. Now I will have UserForm
> > class also which will have all the getter/setter methods of ny User
> > Object so as to faciliate the CRUD operation from the browser.
> >
> >
> > If something changes I need to go and change it in both the places.
> >
> > Is there any way to over come this problem.
> >
> > Any help would be greatly appreciated.
> >
> > Rajesh Kanade
> >
> >
>
>
> --
> To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message