Re: Bean Utils Problems transferring Indexed Properties.....String []--Integer []

2002-07-10 Thread Craig R. McClanahan



On Wed, 10 Jul 2002, Rajesh Kalluri wrote:

 Date: Wed, 10 Jul 2002 14:31:10 -0400
 From: Rajesh Kalluri [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Subject: Bean Utils Problems transferring Indexed Properties.String
 []--Integer []


 Hi

 I am trying to commons-beanutils to transfer data from  a String [] in a
 form-bean
 to a data bean with a Integer[].

 My String[] has three elements when it comes from the ActionForm.

 BeanUtils.populate(bean,map); copys only the first element of the String[]
 into the integer array.

 I searched the archives and the nightly build of commons is supposed to
 solve the problem, i tried and it did not help.

 Can any one help me with this issue, i am stuck.


  Integer integerArray[] =
(Integer[]) ConvertUtils.convert(stringArray, Integer.class);

 regards
 Rajesh

Craig


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Bean Utils Problems transferring Indexed Properties.....String []--Integer []

2002-07-10 Thread Rajesh Kalluri

Craig,

I have this Integer[] as part of a bean and String [] as part of a form bean

Do i have to register custom describe to transfer data from a bean having a
string[] to an Integer

in order to use BeanUtils.populate(). If so do you have an example.


// I am trying to transfer liek this.

Map Properties = BeanUtils.describe(formBean);

BeanUtils.populate(dataBean,map);

DATA BEAN:
/**
 * The authors of the article
 * p
 */
 private Integer[] authors;


/**
 * Returns the authors.
 * @return Integer[]
 */
public Integer[] getAuthors() {
return authors;
}

/**
 * Sets the authors.
 * @param authors The authors to set
 */
public void setAuthors(Integer[] authors) {
this.authors = authors;
}

FORM BEAN:
 /**
 * The author of the article
 * p
 */
private String[] authors;




/**
 * Returns the authors.
 * @return Integer[]
 */
public String[] getAuthors() {
return authors;
}

/**
 * Sets the authors.
 * @param authors The authors to set
 */
public void setAuthors(String[] authors) {
this.authors = authors;
}



-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 2:48 PM
To: Struts Users Mailing List
Subject: Re: Bean Utils Problems transferring Indexed
Properties.String []--Integer []




On Wed, 10 Jul 2002, Rajesh Kalluri wrote:

 Date: Wed, 10 Jul 2002 14:31:10 -0400
 From: Rajesh Kalluri [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Subject: Bean Utils Problems transferring Indexed Properties.String
 []--Integer []


 Hi

 I am trying to commons-beanutils to transfer data from  a String [] in a
 form-bean
 to a data bean with a Integer[].

 My String[] has three elements when it comes from the ActionForm.

 BeanUtils.populate(bean,map); copys only the first element of the String[]
 into the integer array.

 I searched the archives and the nightly build of commons is supposed to
 solve the problem, i tried and it did not help.

 Can any one help me with this issue, i am stuck.


  Integer integerArray[] =
(Integer[]) ConvertUtils.convert(stringArray, Integer.class);

 regards
 Rajesh

Craig


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