Re: Struts setting a String object instead of Integer in the form

Prasanth Pasala <[email protected]>
Newsgroups gmane.comp.jakarta.struts.user
Organization The Pangburn Group
Message-ID <[email protected]>
<s:checkbox class="disableText" name="capDeferral[%{#attr.compensation.enrollmentCompID}]" fieldValue="1" submitUnchecked="true"/>

Thanks,
Prasanth

On 8/14/26 11:24 PM, Lukasz Lenart wrote:
> pt., 14 sie 2026 o 22:36 Prasanth <[email protected]> napisał(a):
>> 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>();
> Can you post the UI, how do you compose the form from tags?
>
>
> Cheers
> Łukasz
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
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.