Multiple checkboxes in a dynamic table

Posted on 2004-11-27
Last Modified: 2008-01-09
I dyanmic table that creates checkbox for each row. the checkbox 'value="<%=j%>" identified by the number of a counter (integer) used in a while loop that creates the table.

Selecting the checkbox returns a null for request.getParameter("nameofCheckbox");

How can I resolve this?
Question by:VbMonk
    LVL 11

    Expert Comment

    If you use multiple checkbox with the same name, you must use this

    String[] multi = request.getParameterValues("nameOfChekcBox");

    Author Comment

    Thanks for the reply but the form is returning an JasperException and java.lang.NullPointerException
    when i tried your solution. What could be the problem.
    LVL 25

    Expert Comment

    for checkboxes unless the check box is checked it will not be passed on the jsp server side
    LVL 11

    Accepted Solution

    it will return null. if no checking.

    Author Comment

    How do i check for this exception here:
    org.apache.jasper.JasperException: For input string: ""
    which comes up if the checkbox has nothing in it?


    Expert Comment

    Why dont you use a Java Script to check if atlease one Checkbox has been selected, before submitting?
    Some code on this terms:
       if (document.formname.fieldname.checked == false &&
             document.formname.fieldname.checked == false &&
           document.formname.fieldname.checked == false) {
           alert("Please select at least one checkbox.\n");
           return false;


    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    This is an issue that we can get adding / removing permissions in the vCSA 6.0. We can also have issues searching for users / groups in the AD (using your identify sources). This is how one of the ways to handle this issues and fix it.
    Read about the 3 stages of the buyer's journey: awareness, consideration, and decision.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now