This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes multibox - nullPointerException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "multibox - nullPointerException" Watch "multibox - nullPointerException" New topic

multibox - nullPointerException

bryan nelson
Ranch Hand

Joined: Jun 16, 2003
Posts: 95
Hello there,
I'm trying to use a multibox for the first time in Struts and am receiving a nullpointerexception when displaying the jsp page:

ApplicationDispatcher[/scmiteam] Servlet.service() for servlet jsp threw exception
at org.apache.struts.util.BeanUtils.getArrayProperty(

my jsp code looks like this:
<logic:iterate id="myElem" name="listBean" property="collection" type="org.something.bean.dto.QuickLinkBean">
<tsegui:row oddColor="#eeeeee" evenColor="#dedede">
<td class="box">
<bean:write name="myElem" property="id"/>
<td class="box">
<html:multibox styleClass="transparent" property="strArray">
<bean:write name="myElem" property="id"/>
<td class="box link" width="300">
<tsegui:link forward="getQuickLink" paramId="id" paramName="myElem" paramProperty="id">
<bean:write name="myElem" property="title"/>
it should also be noted that when i assign the property attribute to another item that isn't in the same formBean i get a 'getter method not found' error. which makes sense because like i said, it ISN'T in the form. i just state this to show that it does indeed seem to be accessing the getStrArray() method from the correct formBean, but only coming up null somehow.
i've also written out my array just after setting it and it does indeed contain the four items i've assigned to it.
any ideas?

"...and the Truth will set you free."
bryan nelson
Ranch Hand

Joined: Jun 16, 2003
Posts: 95
i love posting to forums because within 20 minutes of my post i always figure out my own problem.
anyway, what was that i was initializing the strArray to, let's say 8, but only filling it with 4 items. therefore when my iterate tag got to the strArray[4] it was trying to access a NULL value.
so simple.
hope this helps someone else!!
I agree. Here's the link:
subject: multibox - nullPointerException
Similar Threads
Problem with CheckBox and MultiBox
multibox functionality in struts
Iterator and multibox
multibox query
How to check multibox value is null?