This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Struts and the fly likes multibox  functionality in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "multibox  functionality in struts" Watch "multibox  functionality in struts" New topic

multibox functionality in struts

Sam Mites

Joined: Nov 27, 2005
Posts: 15
Description of the problem:
I have a form which will display rows (Eg 100) with two columns ("vehicleDescription" and "leaseAmount" ). This form should display empty (unchecked) boxes for all the 100 rows on left side. This form has a "Delete" button. Whenever a user wants to delete some displayed rows, user selects check boxes associated with that rows. When the user clicks the Delete button, only those rows with checked boxes, should be retrieved in action class to be passed to delete method.

This is what I have in jsp page
<logic:iterate id = "vehicleLeaseListrowid" name="vehicleLeaseList"
scope = "request" type ="">
<td><html:multibox property="selections"><bean:write name="vehicleLeaseListrowid" property="vehicleId"/></html:multibox></td>
<td class="lblBlk1"><bean:write name = "vehicleLeaseListrowid" property = "vehicleDescription"/></td>
<td class="lblBlk1"><bean:write name = "vehicleLeaseListrowid" property = "leaseAmount"/></td>

This is what I have in actionform
private String[] selections = {};

public void setSelections(String[] selections){
this.selections = selections;

public String[] getSelections(){
return this.selections;

This is what I have in reset method
selections = null;

This is the exception error I am facing:
SRVE0026E: [Servlet Error]-[BeanUtils.populate]: java.lang.IllegalArgumentException: argument type mismatch
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(
at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(
at org.apache.commons.beanutils.PropertyUtils.setProperty(
at org.apache.commons.beanutils.BeanUtils.setProperty(
at org.apache.commons.beanutils.BeanUtils.populate(

Please let me know if any more information is needed??
Can some body please help me with a solution??

Thank You
[ December 10, 2005: Message edited by: Sam Mites ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
My experience is that an "argument type mismatch" error is the result of defining a property in your form bean that is not either a boolean, String, or String array. The field you've shown us looks OK. I'm wondering if there are any other <html:xxxx> tags in your forms that might be causing this problem. Does your form bean have any properties that are not of the above types? a Date perhaps?

Consultant, Sima Solutions
shan Iyer
Ranch Hand

Joined: Jul 13, 2005
Posts: 391
You are right Merrill!!!

I wasted 2 days at my work place with the same error caused by a getter method that returs a date!!!

Warm Regards, S.Iyer
Sam Mites

Joined: Nov 27, 2005
Posts: 15
Hi Merrill,
I have few more properties which are decleared as Collection and FormFile needed for loading files. Will these datatypes affect?

Thank you
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Let me clarify a bit. You can put properties of any data type you want in your form bean. The thing you have to consider when you specify a property in an html:xxx tag is: "Can the Bean Utilities used by Struts convert this value to the appropriate type when it calls the getter or setter for the property?". If you have an html:text tag with property="myDate", and myDate is of type java.util.Date, then no, it can't convert it and you'll get an error. If it's of type int and the user happens to type an integer, then it will, but if the user happens to type a non-ingeger, then you'll get an error message. Obviously, in a tag where struts is expecting a collection, then a collection in your form bean is perfectly ok. Also, type FormFile is ok if you're using it with an html:file tag.

The point is just use common sense in recognizing that whatever gets put into the html form has to get converted to the type that is in the form bean.
I agree. Here's the link:
subject: multibox functionality in struts
jQuery in Action, 3rd edition