Struts help - javax.servlet.ServletException: BeanUtils.populate

D

Dix

Hi all,

This problem is driving me up the wall, any help would greatly restore
my sanity...

I have an ActionForm that has a Collection of Objects, which are
indexed and can display fine, but when I click submit in the form, I
get this ugly error:

javax.servlet.ServletException: BeanUtils.populate
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:805)
....
....

root cause:
java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
java.util.ArrayList.RangeCheck(ArrayList.java:546)
java.util.ArrayList.get(ArrayList.java:321)
org.apache.commons.beanutils.PropertyUtilsBean.getIndexedProperty(PropertyUtilsBean.java:433)
org.apache.commons.beanutils.PropertyUtilsBean.getIndexedProperty(PropertyUtilsBean.java:340)
org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:684)
....
....

Here is my code:

ActionForm fragment:

public class ShowPermissionsForm extends ActionForm {

// --------------------------------------------------------- Instance
Variables
private Collection info;
private ArrayList r = new ArrayList();

public void reset(ActionMapping mapping, HttpServletRequest request) {
}

public ArrayList getR() {
return r;
}

public void setR(ArrayList r) {
this.r = r;
}

JSP fragment:

<html:form action="/showPermissions.do">
<html:hidden property="id" />
<html:hidden property="group" />

<c:forEach var="r" items="${showPermissionsForm.r}">

<tr onMouseOver="this.style.backgroundColor='#DFDFDF'"
onMouseOut="this.style.backgroundColor='#FFFFFF'"
onContextMenu="alert('blub!')">
<html:hidden indexed="true" name="r" property="name" />
<html:hidden indexed="true" name="r" property="is_table" />
<td class="tabledata" width="50"><html:checkbox indexed="true" name="r"
property="viewable"/></td>
<td class="tabledata" width="50"><html:checkbox indexed="true" name="r"
property="insert"/></td>
<td class="tabledata" width="50"><html:checkbox indexed="true" name="r"
property="update"/></td>
<td class="tabledata" width="50"><html:checkbox indexed="true" name="r"
property="delete"/></td>
</tr>

</c:forEach>
</table><br/>
<html:submit value="Save" styleClass="input_boxes"/>
</html:form>


Any ideas? I'm about to jump out the window...


Best regards,

Patrick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top