Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

argument type mismatch  RSS feed

geofrey pony
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!