You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Patrick Scheuerer <ta...@hispeed.ch> on 2004/01/02 05:47:30 UTC
Problem with BeanUtils.copyProperties()
Hi,
Is it not possible to copy a String[] using BeanUtils.copyProperties()?
My DynaValidatorForm has a field property like:
<form-property
name="someProperty"
type="java.lang.String[]"
/>
My Business Bean has the following method:
public void setSomeProperty(String[] data){
}
Every time the copyProperty() method is called it throws the following exception:
java.lang.IllegalArgumentException: argument type mismatch
Can somebody help me out?
Thanks! Patrick
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Problem with BeanUtils.copyProperties()
Posted by Patrick Scheuerer <ta...@hispeed.ch>.
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.copyProperties() doesn't call a setter method
> in the destination bean.
>
> Here's the definition of the form field in struts-config.xml
>
> <form-property name="keywords"
> type="java.lang.String"/>
>
> In the destination bean there's the corresponding setter
> method:
> public void setKeywords(String keywords) {
> ...
> }
>
> For some reason copyProperties() doesn't call my setter method. If I
> step through copyProperties() in the debugger I get until
>
> for (int i = 0; i < origDescriptors.length; i++) {
> ..
> } else {
> --> if (isWriteable(dest, name)) {
> Object value = ((DynaBean) orig).get(name);
> PropertyUtils.setSimpleProperty(dest, name, value);
> }
> }
>
> If I step over the if statement the following block of code is not being
> executed. Why is this property not writeable???
>
> At runtime the property in question in origDescriptors has the value:
>
> DynaProperty[name=keywords,type=class java.lang.String]
>
> Why is the setKeywords(String keywords) method not called on my dest
> bean???
>
> Can somebody please help me out here? What am I doing wrong?
>
> Thanks a lot,
> Patrick
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Problem with BeanUtils.copyProperties()
Posted by Patrick Scheuerer <ta...@hispeed.ch>.
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 in struts-config.xml
<form-property name="keywords"
type="java.lang.String"/>
In the destination bean there's the corresponding setter method:
public void setKeywords(String keywords) {
...
}
For some reason copyProperties() doesn't call my setter method. If I step
through copyProperties() in the debugger I get until
for (int i = 0; i < origDescriptors.length; i++) {
..
} else {
--> if (isWriteable(dest, name)) {
Object value = ((DynaBean) orig).get(name);
PropertyUtils.setSimpleProperty(dest, name, value);
}
}
If I step over the if statement the following block of code is not being
executed. Why is this property not writeable???
At runtime the property in question in origDescriptors has the value:
DynaProperty[name=keywords,type=class java.lang.String]
Why is the setKeywords(String keywords) method not called on my dest bean???
Can somebody please help me out here? What am I doing wrong?
Thanks a lot,
Patrick
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org