i know that this topic has been discussed earlier and i already have one version of indexed properties on another
jsp that runs - but this time i have serious trouble.
I have an ActionForm-Bean which contains a String-Array of Beans.
----CODE----
private ListBean[] beans;
private ListBean bean;
public ListBean[] getBeans()
{
return beans;
}
public void setBeans(int index, ListBean bean)
{
beans[index] = bean;
}
public void setBean(int index, ListBean value)
{
beans[index] = value;
}
public ListBean getBean(int index)
{
return (ListBean) beans[index];
}
--Code end
This code in my jsp look like:
<html:form action="list.do?method=copy" >
<table width="400" border="0" >
<logic:iterate id="speech"
indexId="ctr"
name="CopyListFormBean"
property="beans"
type="istd.client.td.beans.ListBean" >
<tr>
<td width="20%">
<html:checkbox property='<%= "beans[" + ctr + "].copy" %>' />
</td>
<td>
<bean:write name="CopyListFormBean" property='<%= "beans[" + ctr + "].sprache" %>' />
<html:hidden property='<%= "beans[" + ctr + "].sprachId" %>' />
<html:hidden property='<%= "beans[" + ctr + "].listId" %>' />
</td>
</tr>
</logic:iterate>
<tr>
<td>
</td>
<td>
<html:submit />
</td>
</tr>
</html:form>
When Submitting the Form i get the 'popular' ErrorMessage
java.lang.NullPointerException
at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:497)
at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:410)
at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:749)
at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:780)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:793)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:726)
Any Idea? I'm totally frustrated - maybe i need a break.