Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to check multibox value is null?

 
Aswathy TS
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20388
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic