You could just set that property by hand after most of you properties
are copied
BeanUtils.copyProperties( fooBean, barBean);
fooBean.setDate(barBean.getDate());
beanutils would still be doing most the work for you.
On 7 Jan 2004, at 23:32, Larry Meadors wrote:
Yeah, beanutils is a pain that
Yeah, beanutils is a pain that way.
It does the same (and worse IMO) with other data types (i.e., set "fred"
into an Integer, and it becomes 0, not null, and no exception is
thrown).
You might want to try PropertyUtils.copyProperties() instead.
It *might* work.
Larry
>>> [EMAIL PROTECTED] 0
I'm doing a copyProperties to an Entity from a DTO. Why is it that if a
date field is null, a date is returned as if I had passed a value of 0
to the copy method for the date. I.E. I passed a null date into
copyProperties, but I got back a non-null date.
What gives?
Thx,
/tim
-
Hi Ivan,
I had a mistake in my value object. Be sure to check the following things:
For every form field in your form there must be one and only one setter method
with the same name. So if you have a form field called firstName there has to be
a method setFirstName() in your Bean.
The second t
: Re: Problem with BeanUtils.copyProperties()
and in contrary to my earlier problem, there's no other method with the same
method name...
Patrick Scheuerer wrote:
> Argh! I'm about to loose my sanity over this...
>
> The problem with the String[] is now working but there'
Quoting Patrick Scheuerer <[EMAIL PROTECTED]>:
> If there are multiple methods with the same name, shouldn't copyProperties()
> pick the one with the same method signature as in the source bean??? In my
> opinion this would at least be a desirable default behavior
No, it shouldn't.
BeanUtil
and in contrary to my earlier problem, there's no other method with the same
method name...
Patrick Scheuerer wrote:
Argh! I'm about to loose my sanity over this...
The problem with the String[] is now working but there's a new one of
course :-(
For some reason BeanUtils
Argh! I'm about to loose my sanity over this...
The problem with the String[] is now working but there's a new one of course :-(
For some reason BeanUtils.copyProperties() doesn't call a setter method in the
destination bean.
Here's the definition of the form field
I think the javabean spec doesn't allow multiple setters for a single property.
If I'm right, you cannot have two setXXX method with different parameters types, as
beanutils just looks for a method
named "setXXX" without using parameter types.
Nico.
> Ivan De La Pena wrote:
> > Hope this helps
Ivan De La Pena wrote:
Hope this helps :
Thanks Ivan, It did help :-).
The problem I had was a bit strange: in my business object a had a method
setSomeProperty(String[] data) and a method setSomeProperty(Vector data).
copyProperties() called setSomeProperty(Vector data) on my business bean
alth
rties(bean2, bean);
System.out.println(bean2.getArray());
PropertyUtils.copyProperties(bean3, mp);
System.out.println(bean3.getArray());
}
}
Ivan
-Original Message-
From: Patrick Scheuerer [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 01, 2004 11:48 PM
To: Struts
Hi,
Is it not possible to copy a String[] using BeanUtils.copyProperties()?
My DynaValidatorForm has a field property like:
My Business Bean has the following method:
public void setSomeProperty(String[] data){
}
Every time the copyProperty() method is
On Thu, Sep 11, 2003 at 09:04:11AM -0700, Mick Knutson wrote:
} I have a Value Object that contains a starting java.util.Date and ending
} java.util.Date.
} I am using java.lang.String objects in my DynaForm and my JSP.
} I currently add the dates to the DynaForm manually, and then perform a
} copy
I have a Value Object that contains a starting java.util.Date and ending
java.util.Date.
I am using java.lang.String objects in my DynaForm and my JSP.
I currently add the dates to the DynaForm manually, and then perform a
copyProperties(). But the copyProperties fails with a type mismatch.
So, wh
Hi, need help with ActionForm and BeanUtils.copyProperties.
Basically, i want my POJO properties to be null if the associated
ActionForm is empty string or null.
But using BeanUtils.copyProperties, the destination gets its properties
default values.
for example in my POJO, Float property gets a
Here it is:
--- StringArrayConverter.java.orig 2003-03-21 04:43:17.0 -0500
+++ StringArrayConverter.java 2003-03-21 04:43:20.0 -0500
@@ -113,6 +113,10 @@
// --- Static Variables
+ /**
+* Model object
Dan Allen ([EMAIL PROTECTED]) wrote:
> Mitchell Morris ([EMAIL PROTECTED]) wrote:
>
> > Hmmm ... looking in the BeanUtils javadocs, I see there's already an
> > IntegerArrayConverter which turns a String[] into an int[]. Oh look! The
> > author's name seems oddly familiar; anybody know some guy
Mitchell Morris ([EMAIL PROTECTED]) wrote:
> Hmmm ... looking in the BeanUtils javadocs, I see there's already an
> IntegerArrayConverter which turns a String[] into an int[]. Oh look! The
> author's name seems oddly familiar; anybody know some guy named "Craig R.
> McClanahan"?
>
> just-need-to-
e-ly y'rs,
+Mitchell
> -Original Message-
> From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]
> Sent: Sunday, March 16, 2003 9:21 PM
> To: Struts Users Mailing List
> Subject: RE: BeanUtils.copyProperties between from and DAO issues
>
>
>
>
> On Sat, 15 Mar 2003,
On Sat, 15 Mar 2003, Khalid K. wrote:
> Date: Sat, 15 Mar 2003 13:21:01 -0800
> From: Khalid K. <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
> Subject: RE: BeanUtils
I see where you were going:
#1. Post a request for enhancement in bugzilla for commons.(which will
CC commons-dev), not in Struts, and not in User.
#2. Wait a while.
#3. Give up waiting, and extend BennUtils to do what you need it to do.
#4. Submit a enhancement code to BeanUtils bugzila, thu
Khalid K. ([EMAIL PROTECTED]) wrote:
> If this is the case, I would think that
> org.apache.commons.beanutils.BeanUtils should be modified to do String[]
> to int[] conversion ???
> Thati s my 2 cents :)
Thank you!! Me too. Okay, let's go with this! Devs?
Also, when doing the conversion, any
sers Mailing List
Subject: RE: BeanUtils.copyProperties between from and DAO issues
-Original Message-
From: Dan Allen [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 15, 2003 9:14 AM
To: Struts Users Mailing List
Subject: Re: BeanUtils.copyProperties between from and DAO issues
Right, b
-Original Message-
From: Dan Allen [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 15, 2003 9:14 AM
To: Struts Users Mailing List
Subject: Re: BeanUtils.copyProperties between from and DAO issues
Right, but I was hoping that perhaps it should do this conversion
itself. Here's why
as a signature
public void setIndustryIds(int[] industryIds) {}
my form has a field
the BeanUtils.copyProperties doesn't see that these two properties
should be linked, it simply doesn't call the setIndustryIds()
method. Can
t as a
java.lang.String[] since all form elements must be of type String
(am I right?)
Now, either I am populating from my form or populating to my form
using BeanUtils.copyProperties(). It would appear as though the
following conversion is failing horribly
int[] --> String[]
and
String[] --&g
as a
> > java.lang.String[] since all form elements must be of type String
> > (am I right?)
> >
> > Now, either I am populating from my form or populating to my form
> > using BeanUtils.copyProperties(). It would appear as though the
> > following conversion is failing
which I populate with all the
industries from the database table. The multiple-select is set as a
java.lang.String[] since all form elements must be of type String
(am I right?)
Now, either I am populating from my form or populating to my form
using BeanUtils.copyProperties(). It would appear as
which I populate with all the
industries from the database table. The multiple-select is set as a
java.lang.String[] since all form elements must be of type String
(am I right?)
Now, either I am populating from my form or populating to my form
using BeanUtils.copyProperties(). It would appear as
Hi,
I have been trying to use BeanUtils.copyProperties in my Action to copy
data from the ValidatorForm to
the ServiceInvoiceHdr bean. I keep getting the following error message:
"No value specified."
I have searched the archives and spent 3 days on trying to solve this.
Any hel
at it doesn't
handle Collection or ints, longs, etc is going to kill me.
Anyone know of a better tool out there?
Also, I am assuming that the BeanUtils.copyProperties() method will
not handle nested beans. So I will have to manually do that copy
properties on the nested beans and then ma
eumann [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 08, 2003 5:22 PM
> To: Struts Users Mailing List
> Subject: Re[2]: Model Layer question.. where to put
> BeanUtils.copyProperties (sort of long)
>
>
>
>
> On Wednesday, January 8, 2003, 5:07:24 PM, Robert wrote:
&
On Wednesday, January 8, 2003, 5:21:57 PM, Rick wrote:
RR> On Wednesday, January 8, 2003, 5:07:24 PM, Robert wrote:
RT>> If you are using DynaActionForm or DynaValidatorActionForm then you can
RT>> cast the form to a DynaBean in your Action class and pass it to the business
RT>> layer.
RT>> Thi
On Wednesday, January 8, 2003, 5:11:59 PM, Juan wrote:
AJc> Can you register the exceptions that beanutils throws in the
AJc> struts config???
Actually I thought about doing that also. Might not be a bad idea.
Each of my action mappings is going to start to get pretty large
though:)
--
Ric
On Wednesday, January 8, 2003, 5:07:24 PM, Robert wrote:
RT> If you are using DynaActionForm or DynaValidatorActionForm then you can
RT> cast the form to a DynaBean in your Action class and pass it to the business
RT> layer.
RT> This does not couple your business/service layer to Struts. It does
Can you register the exceptions that beanutils throws in the struts
config???
-Original Message-
From: Rick Reumann [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 08, 2003 4:57 PM
To: Struts List
Cc: model struts
Subject: Model Layer question.. where to put BeanUtils.copyProperties
> I don't really like the idea of passing the ActionForm into the
> service layer since that couples the service layer to Struts, although
> maybe that's not too big of a deal.
If you are using DynaActionForm or DynaValidatorActionForm then you can
cast the form to a DynaBean in your Action class a
hat most
of my dispatch action methods have.
The question I have though is where to best do the form/DTO conversion
provided by BeanUtils.copyProperties(). To give you some background my
current architecture looks like this (using JDBC)...
JSP ---
dispatch Action ---
calls a Service class
>>
>> Hi,
>>
>> Struts1.1b2: BeanUtils.copyProperties(formBean, javaBean) not
>> converting
>> String properties into Dates:
>>
It will not covert them into java.util.Date. You need to create a
Converter class to do it an register it. I just
Hi,
have you tried the other way round?
BeanUtils.copyProperties(javaBean, formBean)
robert
> -Ursprüngliche Nachricht-
> Von: Clayson, Jim [mailto:Jim.Clayson@;centrica.co.uk]
> Gesendet: Donnerstag, 17. Oktober 2002 18:38
> An: '[EMAIL PROTECTED]'
> Betreff:
Hi,
Struts1.1b2: BeanUtils.copyProperties(formBean, javaBean) not converting
String properties into Dates:
I am trying to figure out what is wrong with what I am doing. I have a form
bean with date string properties (from and to) which I would like to copy
into a javabean class. When I print out
On Mon, 15 Jul 2002, Struts Newsgroup wrote:
> Date: Mon, 15 Jul 2002 09:10:03 -0700
> From: Struts Newsgroup <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Is BeanUtils.copyProperties meant to
Subject: Is BeanUtils.copyProperties meant to replace "mapping" utilities
From: "Matt Raible" <[EMAIL PROTECTED]>
===
I'm currently using:
http://www.mycgiserver.com/~andrej/technical/struts/struts.jsp
Will BeanUtils.copyProperties do this same thing?
Thanks
43 matches
Mail list logo