• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IllegalArgumentException

 
Ravi Gupt
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I wrote a formBean which has getter setter for an arrayList.
my getter is:


public Collection getLdapVOList() {
// return arrayList object
}

setter is:

public void setLdapVOList(Collection ldapVOList){
this.ldapVOList =(ArrayList) ldapVOList;
}


in JSP:

im setting this arraylist as hidden value.

<input type="hidden" name="ldapVOList" value="<c ut value="${userValidationServerForm.ldapVOList}"/>">


and while submitting the form I am getting this exception:


java.lang.IllegalArgumentException: Cannot invoke com.intruvert.ui.struts.configure.admin.nac.userValidationServer.UserValidationServerForm.setLdapVOList - argument type mismatch
at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1778)
at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1759)
at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648)
at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677)
at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022)

much more......
 
Ravi Gupt
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
luks like Problem is in setting arrayList object from hidden field to setter in bean.

please help.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
guptaravi,

Please check your private messages for an important message from me. You can do so by clicking My Private Messages on the upper right part of this page.
[ October 16, 2007: Message edited by: Merrill Higginson ]
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot store an entire collection as a single hidden field on a form. I can remember in one case where I had to store a list of id values in a hidden field. I created methods like "String getIdListAsString()" and "void setIdListAsString(String list)". I then had code to create a delimited string from the list of IDs (like "34,48,238") and code to parse the string and create a list. You might be able to use the approach if your Collection just holds simple types.

- Brent
 
Scott Selikoff
author
Saloon Keeper
Posts: 4028
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Ravi G"

Your name still does not conform to the JavaRanch Naming Policy. Please review the policy and update it appropriately. This is your second warning.

Scott Selikoff
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic