Thanks Ted,
I am still not clear how should i implement the Employee value object. 1. should i keep it as a field on EmpForm? 2. should i store it in Request object so that it would be available to EmpForm 3. What should i do , in case if i get a list of EmpVo? i mean how should i implement this list? should i use a Collection nad store it on a EmpForm or in Request object? Thanks Vivek >From: Ted Husted <[EMAIL PROTECTED]> >Reply-To: [EMAIL PROTECTED] >To: Struts Users Mailing List <[EMAIL PROTECTED]> >Subject: Re: Need Design Help >Date: Fri, 24 May 2002 07:14:27 -0400 > >This seems fine, except that EmpForm should have all the display >properties that your application needs. > >This may or may not be all the properties for an employee. It may also >include properties that would not pertain to an employee, like the >hidden field cited in (2). > >It's possible that you might want an EmpBean that has all the properties >of an employee, and an EmpForm that has all the properties of an >employee form. > >These properties used by these objects may intersect, but each is a >different object. (Like the the difference between a job applicant and a >job application form.) > >-- Ted Husted, Husted dot Com, Fairport NY US >-- Developing Java Web Applications with Struts >-- Tel: +1 585 737-3463 >-- Web: http://husted.com/about/services > > >vivek shrivastava wrote: > > > > Hi, > > > > I am trying to learn and create a working DB based application using >struts. > > I have figured out following steps to follow, may be this is not the >best > > practice. I would like to get some comments from struts and Java guru. > > Please feel free to correct me. > > > > 1. Create a EmpForm class which has all the property of a employee and > > all the set and get methods. This EmpForm also may has a colloection > > of EmpVO ( value object) fiels. This class extend ValidatorForm > > class and implement Iterator interface. > > > > Q. I still not sure, where should I store EmpVO, whether as a field > > in EmpForm or in Request object? Please advise here > > > > 2. Create a BaseAction class. Which extend the Action class and > > override the execute method. Based on a hidden field execute method > > call different methods (like for save or new or display). All these > > methods will be override in proper sub class. > > > > 3. Create a EmpAction class which extend BaseAction class. Override the > > required methods. Let’s say it override displayEmp method. > > DisplayEmp return a Collection of EmpVO. > > > > In DisplayEmp method we do following things > > EmpBO empbo = new EmpBO() // EmpBO is business delegates > > Collection empVO = empbo.getVO() > > > > 4. Create a class EmpDAOFactory to get the actual Implementation of > > BaseDAO interface using JNDI. It has a getDAO() function that will > > return EmpDAO. > > > > In the contructor of EmpBO > > EmpDAO empdao = EmpDAOFactory.getDAO() > > > > In getVO() function of EmpBO > > return empdao.DisplayEmp() > > > > 5. BaseDAO interface has all the functions related to user actions > > (like save,display,new..) and will be implemented by a every DB > > access related classes. > > > > 6. constructor of EmpDAO uses JNDI to get a instance of datastore using > > deployment descriptor. > > > > EmpDAO.DisplayEmp() function do following > > Get dbconnection > > Build and Execute sql > > Build EmpVO > > Close the dbconnection > > Return EmpVO > > > > 7. At this ponit control will go back to EmpAction class, and now > > EmpAction has Collection of EmpVO. Now we can either set this EMPVO > > to a filed in EmpForm or store it in Request object. ( I am not sure > > which one is better) > > > > Your comments would be greatly appreciated. Please help me to build my >first > > application. > > > > Thanks > > > > _________________________________________________________________ > > Get your FREE download of MSN Explorer at >http://explorer.msn.com/intl.asp. > > > > -- > > 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]> _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>