Spring MVC web application: No default constructor found
Inside your controller method , you have used a parameter as array like below
@ModelAttribute("dslrs") DSLR dslrs[]
so use collection like list instead
@ModelAttribute("dslrs") ArrayList<DSLR> dslrs
This is the error message you would get if DSLR
had no default constructor:
java.lang.NoSuchMethodException: main.java.com.springapp.mvc.model.DSLR.<init>()
Now compare this to your error message:
java.lang.NoSuchMethodException: [Lmain.java.com.springapp.mvc.model.DSLR;.<init>()
Do you notice the difference? The [L
? The error means that you cannot instantiate an array with a constructor, because an array has no constructor. That's why you can't use an array as a parameter for your controller method. At least not that way. Use a collection and you are fine.