This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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."
Joined: Jun 16, 2003
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 it was trying to access a NULL value. so simple. hope this helps someone else!!