aspose file tools
The moose likes Struts and the fly likes argument type mismatch Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "argument type mismatch" Watch "argument type mismatch" New topic

argument type mismatch

geofrey pony

Joined: Jul 18, 2006
Posts: 15
I have an ArrayList (Collection of Detail class) in an action class which is set onto ActionForm. The list in the actionform then gets rendered using logic iterate in the jsp. However, When the form is submitted from JSP I want the list to get resend and reset into the Action form so that the list is repopulated with the correct collection before the validation is invoked.

I have overridden the reset method in the Action Form so that a new list is created and populated with approprate bean based on the size (hidden variable maintains the size of the list) before the validate method is called.

The Jsp gets rendered appropriately. On submitting, the reset method in Action Form executes appropriately as expected. However, I get
java.lang.IllegalArgumentException: argument type mismatch
before the validate method is invoked.

Following is the code of the ActionForm class.

private List payPlan;
//getter & setter available

public void reset(ActionMapping mapping, HttpServletRequest request) {".......calling reset......");
String sizeId = (String)request.getParameter("size");"sizeId .." + sizeId);
if (sizeId !=null && Integer.parseInt(sizeId) > 0) {
payPlan = new ArrayList();
for (int i=0;i<Integer.parseInt(sizeId);i++) {"..added new instance..");
payPlan.add(new Detail());

}"....... reset.end .....");

public ActionErrors validate(ActionMapping mapping,HttpServletRequest request) {"....validate invoked....");

Following is the code of the Detail class. The ArrayList contains a collection of this Class

public class Detail {

private String description;

private String amount;

public Detail(){

public Detail(String description, String amount){
this.description = description;
this.amount = amount;

getter & setters present for each instance variable

Do let me know more code related to this is needed . I am not being able to understand why there is a type mismatch.
Thanks in advance
I agree. Here's the link:
subject: argument type mismatch