• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

argument type mismatch

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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) {
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
reply
    Bookmark Topic Watch Topic
  • New Topic