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

    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="com.sp.dct.security.bo.ResourceBO" indexId="index">

    <tr>
    <td><html:multibox property="resourcechecked"
    value="<%=data.getResourceName()%>"></html:multibox></td>

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

    </td>
    <td><bean:write name="data" property="resourceName" /></td>
    <td><bean:write name="data" property="description" /></td>
    <td><html:multibox property="viewStatusChecked"
    value="<%=data.getResourceName()%>"></html:multibox></td>
    <td><html:multibox property="editStatusChecked"
    value="<%=data.getResourceName()%>"></html:multibox></td>



    and corresponding action class code is


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

    resourceName= roleBean.getResourcechecked();
    viewChecked=roleBean.getViewStatusChecked();
    editChecked=roleBean.getEditStatusChecked();

    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
    Location
    SW Missouri
    Posts
    17,259
    Rep Power
    25

    Default

    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, 05: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, 07:24 PM
  4. Can someone check my code
    By joz_12345 in forum Java 2D
    Replies: 7
    Last Post: 02-18-2008, 02:58 AM
  5. spell check
    By kazitula in forum Java Applets
    Replies: 2
    Last Post: 12-20-2007, 11:37 AM

Posting Permissions

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