Re: Passing an (Dyna)ActionForm to the business object

2002-11-06 Thread Vincent Stoessel
They actually come from commons Beanutils.


http://jakarta.apache.org/commons/beanutils.html

API

http://jakarta.apache.org/commons/beanutils/api/index.html

[EMAIL PROTECTED] wrote:

Chris -
Where are these classes? I can't find them in the api? (1.1-b2)

Thanks,
Kevin Hooke

Quoting Chris Schneider:



Almost forgot about PropertyUtils.copyProperties and
BeanUtils.copyProperties
(I think the difference is that BeanUtils handles type conversion). If


the


property names of your model match the property names of your form, you


should


be able to use one of those methods to populate your model with a single


method


call.






This email message and all attachments transmitted with it are for the sole
use of the intended recipient(s) and may contain confidential and
privileged information. Please DO NOT forward this email outside of the
recipient's Company unless expressly authorized to do so herein.  Any
unauthorized review, use, disclosure or distribution is prohibited. If you
are not the intended recipient, please contact the sender by reply email
and destroy all copies of the original message.

Any views expressed in this email message are those of the individual
 sender except where the sender specifically states them to be the views of
 Indus
 International, Inc.





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



--
Vincent Stoessel
Linux Systems Developer
vincent xaymaca.com


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




Re: Passing an (Dyna)ActionForm to the business object

2002-11-06 Thread Kris Schneider
Yup, and they're distributed with Struts 1.1 in commons-beanutils.jar.

Quoting Vincent Stoessel [EMAIL PROTECTED]:

 They actually come from commons Beanutils.
 
 
 http://jakarta.apache.org/commons/beanutils.html
 
 API
 
 http://jakarta.apache.org/commons/beanutils/api/index.html
 
 [EMAIL PROTECTED] wrote:
  Chris -
  Where are these classes? I can't find them in the api? (1.1-b2)
  
  Thanks,
  Kevin Hooke
  
  Quoting Chris Schneider:
  
  
 Almost forgot about PropertyUtils.copyProperties and
 BeanUtils.copyProperties
 (I think the difference is that BeanUtils handles type conversion). If
  
  the
  
 property names of your model match the property names of your form, you
  
  should
  
 be able to use one of those methods to populate your model with a single
  
  method
  
 call.
  
  
  
  
  
  This email message and all attachments transmitted with it are for the
 sole
  use of the intended recipient(s) and may contain confidential and
  privileged information. Please DO NOT forward this email outside of the
  recipient's Company unless expressly authorized to do so herein.  Any
  unauthorized review, use, disclosure or distribution is prohibited. If
 you
  are not the intended recipient, please contact the sender by reply email
  and destroy all copies of the original message.
  
  Any views expressed in this email message are those of the individual
   sender except where the sender specifically states them to be the views
 of
   Indus
   International, Inc.
  
  
  
  
  
  --
  To unsubscribe, e-mail:  
 mailto:struts-user-unsubscribe;jakarta.apache.org
  For additional commands, e-mail:
 mailto:struts-user-help;jakarta.apache.org
 
 
 -- 
 Vincent Stoessel
 Linux Systems Developer
 vincent xaymaca.com
 
 
 --
 To unsubscribe, e-mail:  
 mailto:struts-user-unsubscribe;jakarta.apache.org
 For additional commands, e-mail:
 mailto:struts-user-help;jakarta.apache.org
 


-- 
Kris Schneider mailto:kris;dotech.com
D.O.Tech   http://www.dotech.com/

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




RE: Passing an (Dyna)ActionForm to the business object

2002-11-06 Thread edgar
They were deprecated in 1.0.2 and removed in 1.1.

Edgar

-Original Message-
From: [EMAIL PROTECTED] [mailto:Kevin.Hooke;indus.com] 
Sent: Wednesday, November 06, 2002 12:20 PM
To: '[EMAIL PROTECTED]'
Subject: Passing an (Dyna)ActionForm to the business object


Chris -
Where are these classes? I can't find them in the api? (1.1-b2)

Thanks,
Kevin Hooke

Quoting Chris Schneider:

Almost forgot about PropertyUtils.copyProperties and 
BeanUtils.copyProperties (I think the difference is that BeanUtils 
handles type conversion). If
the
property names of your model match the property names of your form, 
you
should
be able to use one of those methods to populate your model with a 
single
method
call.




This email message and all attachments transmitted with it are for the
sole use of the intended recipient(s) and may contain confidential and
privileged information. Please DO NOT forward this email outside of the
recipient's Company unless expressly authorized to do so herein.  Any
unauthorized review, use, disclosure or distribution is prohibited. If
you are not the intended recipient, please contact the sender by reply
email and destroy all copies of the original message.

Any views expressed in this email message are those of the individual
sender except where the sender specifically states them to be the views
of  Indus  International, Inc.





--
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




RE: Passing an (Dyna)ActionForm to the business object

2002-11-06 Thread Kris Schneider
Only the classes that were *bundled* in 1.0.2 have been deprecated 
(org.apache.struts.util package). The classes now live in Commons BeanUtils 
(org.apache.commons.beanutils package), as previously answered.

Quoting edgar [EMAIL PROTECTED]:

 They were deprecated in 1.0.2 and removed in 1.1.
 
 Edgar
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:Kevin.Hooke;indus.com] 
 Sent: Wednesday, November 06, 2002 12:20 PM
 To: '[EMAIL PROTECTED]'
 Subject: Passing an (Dyna)ActionForm to the business object
 
 
 Chris -
 Where are these classes? I can't find them in the api? (1.1-b2)
 
 Thanks,
 Kevin Hooke
 
 Quoting Chris Schneider:
 
 Almost forgot about PropertyUtils.copyProperties and 
 BeanUtils.copyProperties (I think the difference is that BeanUtils 
 handles type conversion). If
 the
 property names of your model match the property names of your form, 
 you
 should
 be able to use one of those methods to populate your model with a 
 single
 method
 call.
 
 
 
 
 This email message and all attachments transmitted with it are for the
 sole use of the intended recipient(s) and may contain confidential and
 privileged information. Please DO NOT forward this email outside of the
 recipient's Company unless expressly authorized to do so herein.  Any
 unauthorized review, use, disclosure or distribution is prohibited. If
 you are not the intended recipient, please contact the sender by reply
 email and destroy all copies of the original message.
 
 Any views expressed in this email message are those of the individual
 sender except where the sender specifically states them to be the views
 of  Indus  International, Inc.
 
 
 
 
 
 --
 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
 


-- 
Kris Schneider mailto:kris;dotech.com
D.O.Tech   http://www.dotech.com/

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




RE: Passing an (Dyna)ActionForm to the business object

2002-11-05 Thread Robert Taylor
I would say you wouldn't necessarily violate MVC if you pass the
DynaActionForm as a DynaBean into your model. Your model doesn't need
an Form functionality, it only needs to access the data which is supported
by the DynaBean contract. DynaBean is not bound to any presentation layer
and
therefore does not couple your business tier to your web tier.

When passing data from my web tier to the business tier, I tend to convert
the data contained in the form into data structures native to the business
tier;
Data Transport Objects (DTO) sometimes refered to as ValueObjects. I then
pass
around these DTOs.

There has been plenty of discussion on this list and depending on which
engineer
you speak with you may get a different answer. For more information on this,
search
the archives.

HTH,

robert

 -Original Message-
 From: Vincent Stoessel [mailto:vincent;xaymaca.com]
 Sent: Tuesday, November 05, 2002 2:34 PM
 To: Struts Users
 Subject: Passing an (Dyna)ActionForm to the business object


 I know I have probably violated MVC by doing this but
 while trying to find an elegant solution to passing
 field values between my Action classes and my Model Classes
 I went ahead and passed the whole darn DyaActionForm (daf)
 to my Model class:

 Why did I got to the dark side? It was so convenient to
 only have to add/remove fields in one class (and in struts-config.xml).
 I am working with a massive form that is in flux and editing 2 classes
 all the time was slowing me down:

 // The Old way: the force
 in myAction:

  DynaActionForm daf  = (DynaActionForm) acForm  ;
  myModel mym  = new myModel();
 String firstname = (String) daf.get(fname);
 String lastname = (String) daf.get(lname) ;
 String street = (String)daf.get(street) ;
 String city = (String)daf.get(city) ;
 String state = (String)daf.get(state) ;

 myModel.doBusiness(firstname, lastname,street,city,state);




 then in myModel:

 PreparedStatement   pstmt  = con.prepareStatement(qstr);
  pstmt.setString(1,(String)daf.get(firstname));
  pstmt.setString(2,(String)daf.get(lastname));
  pstmt.setString(3,(String)daf.get(street));
  pstmt.setString(4, (String)daf.get(city));
  pstmt.setString(5, (String)daf.get(state));



 // the New Way: the dark side

 now I can just do:

 myModel mym  = new myModel();
 myModel.doBusiness(daf);


 Yes, in myModel class  I still have to break out daf.getXXX but at least
 now all thefields can be managed from one place and less prone to
 mismached case/spelling (for me anyway) than it was before.

 Of course I really do not want to violate the Struts MVC model, is there
 a better way than the first method?

 Thanks All


 --
 Vincent Stoessel
 Linux Systems Developer
 vincent xaymaca.com


 --
 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




RE: Passing an (Dyna)ActionForm to the business object

2002-11-05 Thread Kris Schneider
+1

Although it may seem like splitting hairs because (in your case) the same 
object instance is passed to the doBusiness method, there's a huge 
architectural/design difference between:

public class myModel {
  public void doBusiness(DynaActionForm data) {
  ...
  }
}

and:

public class myModel {
  public void doBusiness(DynaBean data) {
  ...
  }
}

I suppose another possibility would be to use BeanUtils.describe or 
PropertyUtils.describe (not sure which is preferred) to generate a Map to pass 
to the doBusiness method. Either describe method can deal with a DynaBean.

Quoting Robert Taylor [EMAIL PROTECTED]:

 I would say you wouldn't necessarily violate MVC if you pass the
 DynaActionForm as a DynaBean into your model. Your model doesn't need
 an Form functionality, it only needs to access the data which is
 supported
 by the DynaBean contract. DynaBean is not bound to any presentation layer
 and
 therefore does not couple your business tier to your web tier.
 
 When passing data from my web tier to the business tier, I tend to convert
 the data contained in the form into data structures native to the business
 tier;
 Data Transport Objects (DTO) sometimes refered to as ValueObjects. I then
 pass
 around these DTOs.
 
 There has been plenty of discussion on this list and depending on which
 engineer
 you speak with you may get a different answer. For more information on
 this,
 search
 the archives.
 
 HTH,
 
 robert
 
  -Original Message-
  From: Vincent Stoessel [mailto:vincent;xaymaca.com]
  Sent: Tuesday, November 05, 2002 2:34 PM
  To: Struts Users
  Subject: Passing an (Dyna)ActionForm to the business object
 
 
  I know I have probably violated MVC by doing this but
  while trying to find an elegant solution to passing
  field values between my Action classes and my Model Classes
  I went ahead and passed the whole darn DyaActionForm (daf)
  to my Model class:
 
  Why did I got to the dark side? It was so convenient to
  only have to add/remove fields in one class (and in struts-config.xml).
  I am working with a massive form that is in flux and editing 2 classes
  all the time was slowing me down:
 
  // The Old way: the force
  in myAction:
 
   DynaActionForm daf  = (DynaActionForm) acForm  ;
   myModel mym  = new myModel();
  String firstname = (String) daf.get(fname);
  String lastname = (String) daf.get(lname) ;
  String street = (String)daf.get(street) ;
  String city = (String)daf.get(city) ;
  String state = (String)daf.get(state) ;
 
  myModel.doBusiness(firstname, lastname,street,city,state);
 
 
 
 
  then in myModel:
 
  PreparedStatement   pstmt  = con.prepareStatement(qstr);
   pstmt.setString(1,(String)daf.get(firstname));
   pstmt.setString(2,(String)daf.get(lastname));
   pstmt.setString(3,(String)daf.get(street));
   pstmt.setString(4, (String)daf.get(city));
   pstmt.setString(5, (String)daf.get(state));
 
 
 
  // the New Way: the dark side
 
  now I can just do:
 
  myModel mym  = new myModel();
  myModel.doBusiness(daf);
 
 
  Yes, in myModel class  I still have to break out daf.getXXX but at least
  now all thefields can be managed from one place and less prone to
  mismached case/spelling (for me anyway) than it was before.
 
  Of course I really do not want to violate the Struts MVC model, is there
  a better way than the first method?
 
  Thanks All
 
 
  --
  Vincent Stoessel
  Linux Systems Developer
  vincent xaymaca.com
 
 
  --
  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
 


-- 
Kris Schneider mailto:kris;dotech.com
D.O.Tech   http://www.dotech.com/

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




Re: Passing an (Dyna)ActionForm to the business object

2002-11-05 Thread Vincent Stoessel
Kris Schneider wrote:

+1

Although it may seem like splitting hairs because (in your case) the same 
object instance is passed to the doBusiness method, there's a huge 
architectural/design difference between:

public class myModel {
  public void doBusiness(DynaActionForm data) {
  ...
  }
}

and:

public class myModel {
  public void doBusiness(DynaBean data) {
  ...
  }
}

I suppose another possibility would be to use BeanUtils.describe or 
PropertyUtils.describe (not sure which is preferred) to generate a Map to pass 
to the doBusiness method. Either describe method can deal with a DynaBean.

This is cool. I will give it a whirl.
Thanks.


--
Vincent Stoessel
Linux Systems Developer
vincent xaymaca.com


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




RE: Passing an (Dyna)ActionForm to the business object

2002-11-05 Thread Kris Schneider
Almost forgot about PropertyUtils.copyProperties and BeanUtils.copyProperties 
(I think the difference is that BeanUtils handles type conversion). If the 
property names of your model match the property names of your form, you should 
be able to use one of those methods to populate your model with a single method 
call.

Quoting Kris Schneider [EMAIL PROTECTED]:

 +1
 
 Although it may seem like splitting hairs because (in your case) the same 
 object instance is passed to the doBusiness method, there's a huge 
 architectural/design difference between:
 
 public class myModel {
   public void doBusiness(DynaActionForm data) {
   ...
   }
 }
 
 and:
 
 public class myModel {
   public void doBusiness(DynaBean data) {
   ...
   }
 }
 
 I suppose another possibility would be to use BeanUtils.describe or 
 PropertyUtils.describe (not sure which is preferred) to generate a Map to
 pass 
 to the doBusiness method. Either describe method can deal with a DynaBean.
 
 Quoting Robert Taylor [EMAIL PROTECTED]:
 
  I would say you wouldn't necessarily violate MVC if you pass the
  DynaActionForm as a DynaBean into your model. Your model doesn't need
  an Form functionality, it only needs to access the data which is
  supported
  by the DynaBean contract. DynaBean is not bound to any presentation layer
  and
  therefore does not couple your business tier to your web tier.
  
  When passing data from my web tier to the business tier, I tend to
 convert
  the data contained in the form into data structures native to the
 business
  tier;
  Data Transport Objects (DTO) sometimes refered to as ValueObjects. I then
  pass
  around these DTOs.
  
  There has been plenty of discussion on this list and depending on which
  engineer
  you speak with you may get a different answer. For more information on
  this,
  search
  the archives.
  
  HTH,
  
  robert
  
   -Original Message-
   From: Vincent Stoessel [mailto:vincent;xaymaca.com]
   Sent: Tuesday, November 05, 2002 2:34 PM
   To: Struts Users
   Subject: Passing an (Dyna)ActionForm to the business object
  
  
   I know I have probably violated MVC by doing this but
   while trying to find an elegant solution to passing
   field values between my Action classes and my Model Classes
   I went ahead and passed the whole darn DyaActionForm (daf)
   to my Model class:
  
   Why did I got to the dark side? It was so convenient to
   only have to add/remove fields in one class (and in struts-config.xml).
   I am working with a massive form that is in flux and editing 2 classes
   all the time was slowing me down:
  
   // The Old way: the force
   in myAction:
  
DynaActionForm daf  = (DynaActionForm) acForm  ;
myModel mym  = new myModel();
   String firstname = (String) daf.get(fname);
   String lastname = (String) daf.get(lname) ;
   String street = (String)daf.get(street) ;
   String city = (String)daf.get(city) ;
   String state = (String)daf.get(state) ;
  
   myModel.doBusiness(firstname, lastname,street,city,state);
  
  
  
  
   then in myModel:
  
   PreparedStatement   pstmt  = con.prepareStatement(qstr);
pstmt.setString(1,(String)daf.get(firstname));
pstmt.setString(2,(String)daf.get(lastname));
pstmt.setString(3,(String)daf.get(street));
pstmt.setString(4, (String)daf.get(city));
pstmt.setString(5, (String)daf.get(state));
  
  
  
   // the New Way: the dark side
  
   now I can just do:
  
   myModel mym  = new myModel();
   myModel.doBusiness(daf);
  
  
   Yes, in myModel class  I still have to break out daf.getXXX but at
 least
   now all thefields can be managed from one place and less prone to
   mismached case/spelling (for me anyway) than it was before.
  
   Of course I really do not want to violate the Struts MVC model, is
 there
   a better way than the first method?
  
   Thanks All
  
  
   --
   Vincent Stoessel
   Linux Systems Developer
   vincent xaymaca.com
  
  
   --
   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
  
 
 
 -- 
 Kris Schneider mailto:kris;dotech.com
 D.O.Tech   http://www.dotech.com/
 
 --
 To unsubscribe, e-mail:  
 mailto:struts-user-unsubscribe;jakarta.apache.org
 For additional commands, e-mail:
 mailto:struts-user-help;jakarta.apache.org
 


-- 
Kris Schneider mailto:kris;dotech.com
D.O.Tech   http://www.dotech.com/

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