Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1045023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:55:20+00:00 2026-05-16T15:55:20+00:00

I got the checkbox working, but I can’t remember what modification I have done

  • 0

I got the checkbox working, but I can’t remember what modification I have done to my code. it’s never working again. it keeps saying:

org.springframework.web.servlet.tags.form.Checkbox Tag - 
java.lang.NullPointerException
at org.springframework.web.servlet.tags.form.Selected ValueComparator.exhaustiveCompare(SelectedValueCom parator.java:157)

the java looks like this:

public class ServiceRequest implements Serializable {
 ......
    private GenericAddress serviceAddress;
    private String problemDescription;
    private String referenceNumber;   
    private String[] optionExchangeList = new String[10];
        ......

the jsp code looks like this:

<INPUT TYPE="checkbox" NAME="addPrima" onclick="showHideDiv(this,'exchangeOfOption')">
   <spring:message code="serviceRequest.label.ExchangeOfOption"/><br />
   <div id="exchangeOfOption" style="display:none; margin-left : 15px;" >
    <spring:message code="serviceRequest.label.OnsiteExchangeOfDevice"/> <form:checkbox path="serviceRequest.optionExchangeList" value="Duplex"/><br />
                <spring:message code="serviceRequest.label.Drawer"/> <form:checkbox path="serviceRequest.optionExchangeList" value="Drawer"/><br />
                <spring:message code="serviceRequest.label.Feeder"/> <form:checkbox path="serviceRequest.optionExchangeList" value="Feeder"/><br />
                <spring:message code="serviceRequest.label.MaintenanceKit"/> <form:checkbox path="serviceRequest.optionExchangeList" value="Maintenance Kit"/><br />
                <spring:message code="serviceRequest.label.Other"/> <form:checkbox path="serviceRequest.optionExchangeList" value="Other"/>
            </div>  

it worked before. I even use optionExchangeList.toString() to look at the result. it was the names for the one I checked. (it’s impossible huh? should be something like @afaswe) .
and for now. I have to initialize the optionExchangeList as something like:

private String[] optionExchangeList = new String[]{"Duplex","Drawer"};

and for Duplex and Drawer, they stayed checked in the browser. but for the rest field. they stayed unchecked, and even if I check them, they don’t appear in the optionExchangeList if I print them out in the action method using something like:

for (String s:serviceRequest.optionExchangeList){
 System.out.println(s+"\n");
}

the list stayed the same regardless the Checkbox status.

Did I just have a dream??? or did I meet a ghost??? I am going crazy.
HELP!!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:55:21+00:00Added an answer on May 16, 2026 at 3:55 pm

    when I about to use another approach, the light shed on me. to keep it short and clear.
    define your String list with something like

    private String[] optionExchangeList = new String[]{};
    

    no more Exception. it just works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a table with checkbox-style cells, and I can't figure out how to
Got myself in a bit of a pickle here ... working on a CMS
Got a bit of a mind freeze at the moment. I have the following
I'm new to MVC. I've got this all working nicely except when the page
I've got a single checkbox which i'd like the unchecked value to be 0
I can't seem to get this to work. If I remove the checkbox portion
I've been at this for hours but it just isn't working. I'm trying to
I've got a checkbox list in a table. (one of a number of CB's
Got a bluescreen in windows while cloning a mercurial repository. After reboot, I now
got a new blog at wordpress few days ago ( http://ghads.wordpress.com ) and I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.