Results 1 to 2 of 2
  1. #1
    tsaswathy is offline Member
    Join Date
    Sep 2008
    Rep Power

    Question How to check multibox value is null

    I am getting the value of a multibox as a string array...but if none of the boxes are checked then the value becomes null and it is giving null pointer exception...How can i solve that?
    My jsp code is
    <logic:iterate id="data" name="resourcelist"
    type="" indexId="index">

    <td><html:multibox property="resourcechecked"

    <td><bean:write name="data" property="resourceId" />

    <td><bean:write name="data" property="resourceName" /></td>
    <td><bean:write name="data" property="description" /></td>
    <td><html:multibox property="viewStatusChecked"
    <td><html:multibox property="editStatusChecked"

    and corresponding action class code is

    String[] resourceName=new String[30];
    String[] viewChecked=new String[30];
    String[] editChecked=new String[30];

    resourceName= roleBean.getResourcechecked();

    I have tried with array length property ,.equals(null)....everything is giving null pointer exception...Pls give some solution....

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    On vacation
    Rep Power


    If array.length is giving you a NPE then the variable array is null.
    Test if array is null. One or more of your get methods is returning null.

Similar Threads

  1. Check box tag
    By elizaabru in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 08-26-2008, 02:37 PM
  2. CRC check program 1 error
    By javakid9000 in forum New To Java
    Replies: 1
    Last Post: 03-19-2008, 06:04 AM
  3. Check if a web page exists or not
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-02-2008, 08:24 PM
  4. Can someone check my code
    By joz_12345 in forum Java 2D
    Replies: 7
    Last Post: 02-18-2008, 03:58 AM
  5. spell check
    By kazitula in forum Java Applets
    Replies: 2
    Last Post: 12-20-2007, 12:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts