Struts setting a String object instead of Integer in the form

Prasanth <[email protected]>
Newsgroups gmane.comp.jakarta.struts.user
Message-ID <[email protected]>
Hi,

Getting the below exception after a form is submitted. The form has a check box, when this check box is not selected we get the exception. If the check box is selected it works normally. Is there 
anything I should be doing to force struts to put a Integer value in the hash map when the check box is not selected?

  Exception: java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Integer (java.lang.String and java.lang.Integer are in module java.base of loader 'bootstrap')


The code line where it happens is below

                 else if(getEnrollmentForm().getCapDeferral().get(compID) != null && getEnrollmentForm().getCapDeferral().get(compID)==1) {

Variable Declaration:
     @Element(value=java.lang.Integer.class)
     private HashMap<Long, Integer> capDeferral = new HashMap<Long,Integer>();

Struts Version: 7.2.1  have tested it with 7.3.0 and same result.

Appreciate your help.

Thanks,
Prasanth
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.