The call to request.getParameterValues("chkbox") should be returning
null, not throwing an exception.
Anyway, if you want to make sure you have a non-null array with 0 or
more elements, you could write a scriptlet like:

<%
    String[] chkboxes;
    if( request.getParameter("chkbox") == null ) {
        chkboxes = new String[0];
    } else {
        chkboxes = request.getParameterValues("chkbox");
    }
    if( chkboxes.length > 0 ) {
        // . . . do something . . .
    }
%>

"Pillai, Arumugam" wrote:
> Hi there,
>
> When i call
>
>         request.getParameterValues("chkbox")
> and if no chkbox is selected, its throwing a java.lang.NullPointerException
> error.How should i handle this.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to