File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes How to check multibox value is null? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to check multibox value is null?" Watch "How to check multibox value is null?" New topic
Author

How to check multibox value is null?

Aswathy TS
Greenhorn

Joined: Sep 29, 2008
Posts: 2
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...Please give some solution....
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

"Aswathy TS",

Please read your private messages regarding an important announcement.

Thank you,

Rob


Originally posted by Aswathy TS:
I have tried with array length property ,.equals(null)....everything is giving null pointer exception...Please give some solution....

How about actually checking if the variable is null first?

Anyway, moving to JSP.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
Don't get me started about those stupid light bulbs.
 
subject: How to check multibox value is null?
 
Similar Threads
multibox - nullPointerException
multidimensional array and multibox
multibox functionality in struts
Iterator and multibox
multibox query