On 14 Jan 2004, at 03:57, Nathan Ewing wrote:
I have a jsp page with a form on it using indexed properties. I have a bean
with an array of beans that I use to connect with the jsp page. The page
displays fine, but when I try to save it, I get the following error:
javax.servlet.ServletException: BeanUtils.populate
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProces sor.j
ava:821)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java :254)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.StandardWrapperValve.invokeServletService(Stan dardW
rapperValve.java:720)
at
org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrappe rValv
e.java:118)
at
org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValv e.jav
a:278)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVal ve.ja
va:274)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 505)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextVal ve.ja
va:212)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 505)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.jav a:203
)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 505)
at
com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcess or.ja
va:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
Root Cause
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja va:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso rImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyU tils.
java:493)
at
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyU tils.
java:428)
at
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUt ils.j
ava:770)
at
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.ja va:80
1)
at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:881)
at
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProces sor.j
ava:821)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java :254)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.StandardWrapperValve.invokeServletService(Stan dardW
rapperValve.java:720)
at
org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrappe rValv
e.java:118)
at
org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValv e.jav
a:278)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVal ve.ja
va:274)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 505)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextVal ve.ja
va:212)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 505)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.jav a:203
)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 505)
at
com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcess or.ja
va:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
Caused by: java.lang.NullPointerException
at
com.mysite.bean.SoldProperty.getExclusiveSold(SoldProperty.java:573)
Here is the relevant code:
protected SoldProperty[] ExclusiveSold; protected SoldProperty[] BuyerSold;
/** Set the Value of ExclusiveSold to ExclusiveSoldValue @param ExclusiveSoldValue The value of the variable ExclusiveSold in the Object */ public void setExclusiveSold (SoldProperty[] ExclusiveSoldValue) { ExclusiveSold = ExclusiveSoldValue; } /** Get the Value of ExclusiveSold @return The Value of ExclusiveSold */ public SoldProperty[] getExclusiveSold (){ return ExclusiveSold; } /** Set the Value of ExclusiveSold to ExclusiveSoldValue @param ExclusiveSoldValue The value of the variable ExclusiveSold in the Object */ public void setExclusiveSold (int index, SoldProperty ExclusiveSoldValue) { ExclusiveSold[index] = ExclusiveSoldValue; } /** Get the Value of ExclusiveSold @return The Value of ExclusiveSold */ public SoldProperty getExclusiveSold (int index){ return ExclusiveSold[index]; }
/** Set the Value of BuyerSold to BuyerSoldValue @param BuyerSoldValue The value of the variable BuyerSold in the Object */ public void setBuyerSold (SoldProperty[] BuyerSoldValue) { BuyerSold = BuyerSoldValue; } /** Get the Value of BuyerSold @return The Value of BuyerSold */ public SoldProperty[] getBuyerSold (){ return BuyerSold; } /** Set the Value of BuyerSold to BuyerSoldValue @param BuyerSoldValue The value of the variable BuyerSold in the Object */ public void setBuyerSold (int index, SoldProperty BuyerSoldValue) { BuyerSold[index] = BuyerSoldValue; } /** Get the Value of BuyerSold @return The Value of BuyerSold */ public SoldProperty getBuyerSold (int index){ return BuyerSold[index]; }
And the jsp code:
<c:forEach var="exclusive" items="${SoldProperty.exclusiveSold}"
varStatus="status">
<tr>
<td bgcolor="#E0E8F5" align="center"><c:out
value="${exclusive.soldDate}"/></td>
<td bgcolor="#E0E8F5"><html-el:hidden
property="exclusiveSold[${status.index}].soldId"/><a
href="Marketing.app?action=edit&id=<c:out
value="${exclusive.mlsNumber}"/>"><c:out value="${exclusive.streetNumber}"/>
<c:out value="${exclusive.street}"/> <c:out
value="${exclusive.aptNumber}"/></a></td>
<td bgcolor="#E0E8F5" align="center"><c:out
value="${exclusive.price}"/></td>
<td bgcolor="#E0E8F5"
align="center"><html-el:checkbox
property="exclusiveSold[${status.index}].showListing" /></td>
<td bgcolor="#E0E8F5"
align="center"><html-el:checkbox
property="exclusiveSold[${status.index}].showPrice" /></td>
<td bgcolor="#E0E8F5"
align="center"><html-el:checkbox
property="exclusiveSold[${status.index}].showAptNumber" /></td>
<td bgcolor="#E0E8F5" align="center"><html-el:text
property="exclusiveSold[${status.index}].displayPrice" size="8" /></td>
</tr>
</c:forEach>
<c:forEach var="buyer" items="${SoldProperty.buyerSold}" varStatus="status">
<tr>
<td bgcolor="#E0E8F5" align="center"><c:out
value="${buyer.soldDate}"/></td>
<td bgcolor="#E0E8F5"><html-el:hidden
property="buyerSold[${status.index}].soldId"/><a
href="soldProperty.app?action=edit&id=<c:out
value="${buyer.soldId}"/>"><c:out value="${buyer.streetNumber}"/> <c:out
value="${buyer.street}"/> <c:out value="${buyer.aptNumber}"/></a></td>
<td bgcolor="#E0E8F5" align="center"><c:out
value="${buyer.price}"/></td>
<td bgcolor="#E0E8F5"
align="center"><html-el:checkbox
property="buyerSold[${status.index}].showListing" /></td>
<td bgcolor="#E0E8F5"
align="center"><html-el:checkbox
property="buyerSold[${status.index}].showPrice" /></td>
<td bgcolor="#E0E8F5"
align="center"><html-el:checkbox
property="buyerSold[${status.index}].showAptNumber" /></td>
<td bgcolor="#E0E8F5" align="center"><html-el:text
property="buyerSold[${status.index}].displayPrice" size="8" /></td>
</tr>
</c:forEach>
Any ideas why I'm getting this error? And how to fix it?
Thanks, Nathan Ewing
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]