aspose file tools
The moose likes Struts and the fly likes multibox - nullPointerException Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "multibox - nullPointerException" Watch "multibox - nullPointerException" New topic
Author

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
java.lang.NullPointerException
at org.apache.struts.util.BeanUtils.getArrayProperty(BeanUtils.java:217)
...

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>
<td class="box">
<html:multibox styleClass="transparent" property="strArray">
<bean:write name="myElem" property="id"/>
</html:multibox>
</td>
<td class="box link" width="300">
<tsegui:link forward="getQuickLink" paramId="id" paramName="myElem" paramProperty="id">
<bean:write name="myElem" property="title"/>
</tsegui:link>
</td>
</tsegui:row>
</logic:iterate>
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?
thanks!
b


"...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 happening...is 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: http://aspose.com/file-tools
 
subject: multibox - nullPointerException
 
Similar Threads
Iterator and multibox
Problem with CheckBox and MultiBox
multibox functionality in struts
How to check multibox value is null?
multibox query