You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Georg Filios <ge...@filios.de> on 2004/07/22 11:35:31 UTC

Error: html:multibox, backbutton, BeanPopulate Exception (IndexOutOfBoundsException)

Hi,

I am having a unnices error, which I can't solve. Even I am having  
found any hints in the archives, making me very nervous,
that I totally messed up some concepts.

Here is my Problem:
	
I am using a html:multibox to select some entries (the number of the  
entries, is dynamic) i.e 5 different.

When I submit the form, everything goes fine, and after validation in  
my action form,
I can remove in my model all entries, not checked. The model with the  
pruned entries is stored in my session
again (i.e. now I am having 3 entries)

Now the problem occurs. If the user hits the back button (which he is  
isnt supposed to),
he sees the form with all entries ( 5 entries), which makes sense,  
since the browser recalls the cached page.

Now if the user select again a checkbox and submits, i get the an  
IndexOutOfBoundsException (see below).
What makes me really nervous is the fact, that it happens all before  
any of my Actions or Forms are getting involed (except my  
ActionForm.reset method)
So I cant Intervent the double submit (i.e. by using tokens).

Any Ideas how to prevent this siutation, or what might be the real  
cause (since I dont fully understand  what happens)

regards,

Georg

here is my JSP-CODE:
<logic:iterate id="category" name="GenerateCategoryForm"  
property="Categories" indexId="idx">
	<html:multibox property="checkedCategories"><%=idx%><br>
</logic:iterate>


here is the Exception:

exception
javax.servlet.ServletException: BeanUtils.populate
          
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
          
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcess 
or.java:821)
          
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java: 
254)
          
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
          
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          
de.creativetank.gamble.app.websecure.LoggedInFilter.doFilter(Unknown  
Source)


root cause
java.lang.IndexOutOfBoundsException: Index: 2, Size: 1
         java.util.ArrayList.RangeCheck(ArrayList.java:507)
         java.util.ArrayList.get(ArrayList.java:324)
          
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUt 
ils.java:503)
          
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUt 
ils.java:410)
          
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUti 
ls.java:749)
          
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.jav 
a:780)
          
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:793)
          
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:726)
          
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
          
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcess 
or.java:821)
          
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java: 
254)
          
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
          
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          
de.creativetank.gamble.app.websecure.LoggedInFilter.doFilter(Unknown  
Source)








---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org