Your groupesBo is String[] type, not List.
Try sth like:
List listeGroupBo = null;
public void setGroupesBo(String[] groupesBo) {
listeGroupBo = new ArrayList();
for(int i = 0; i < groupesBo.length; i++){
listeGroupBo.add(groupeBo[i]);
}
}
2008/7/31 ePierre <[EMAIL PROTECTED]>
>
> I'm having troubles when trying to convert a List object (in my POJO) to a
> String[] object (in my form).
>
> I'm using AppFuse 1.9.4 with Struts, Hibernate and Spring on a Java 1.4
> edition (yes, I know, but I'm not allowed to upgrade to a better version).
>
> So in my POJO I have this:
>
> private List groupesBo;
>
> And in my form:
>
> protected String[] groupesBo;
>
> When editing an entry ("edit" method of the Action class), it's converting
> correctly, apparently, since the generated Form object is populated by:
> groupesBo[0]=null
> groupesBo[1]="1"
> groupesBo[2]="2"
> groupesBo[3]="3"
> groupesBo[4]=null
>
> (though I don't know why there are two "null" values...)
>
> But when I'm saving this entry, I get an exception:
>
> PropertyUtils.invokeMethod(1777) | Method invocation failed.
> java.lang.IllegalArgumentException:argument type mismatch
> Cannot invoke (...).admin.model.Utilisateur.setGroupesBo - argument type
> mismatch
>
> Of course, my setGroupesBo method is very simple:
>
> public void setGroupesBo(List groupesBo) {
> this.groupesBo = groupesBo;
> }
>
> The problem seems to come from the BeanUtils convert method. Although it
> works fine most of the time, it doesn't work to convert String[] to List.
>
> What can I do to get my save method to work? Is this a bug, or is it just
> something I don't understand properly?
>
> Thanks in advance!
> --
> View this message in context:
> http://www.nabble.com/-AppFuse-1.9.4--Problem-converting-Form%27s-String---to-POJO%27s-List-tp18750102s2369p18750102.html
> Sent from the AppFuse - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>