File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "argument type mismatch" Watch "argument type mismatch" New topic
Author

argument type mismatch

geofrey pony
Greenhorn

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) {
log.info(".......calling reset......");
String sizeId = (String)request.getParameter("size");
log.info("sizeId .." + sizeId);
if (sizeId !=null && Integer.parseInt(sizeId) > 0) {
payPlan = new ArrayList();
for (int i=0;i<Integer.parseInt(sizeId);i++) {
log.info("..added new instance..");
payPlan.add(new Detail());
}

}
log.info("....... reset.end .....");
}

public ActionErrors validate(ActionMapping mapping,HttpServletRequest request) {
log.info("....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: http://aspose.com/file-tools
 
subject: argument type mismatch