Your "shortList" field is changing somehow as you loop over it.  Given that 
both the action bean and the jsp are both single threaded to the current 
request, it is probably not a real concurrency issue (unless you have a 
background thread and a singleton, which I doubt).

Anyway, perhaps your getter method, actionbean.getShortList()  has some logic 
in it that is changing the list and/or its contents?

I think you probably have

public List<T> getShortList()  {
   List<T> x  = findStuffFromDB_OrDoSomethingToProduceList();
   return x;
}

When essentially what you need is:

private List<T> shortList;
public List<T> getShortList()  {return this.shortList};
public Resolution yourEvent()  {
  shortList = findStuffFromDB_OrDoSomethingToProduceList();
  return new ForwardResolution("/WEB-INF/your-jsp.jsp");
}

Alternatively you could put the shortList= bit in an @Before method..   
Problems like this one are easy to troubleshoot by running your container in 
debug mode.  Also the howto on unit testing with MockRoundtrip is a really big 
time saver.


From: David Hamilton [mailto:dhamil...@hermitagelighting.com]
Sent: Tuesday, June 08, 2010 9:08 AM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Exception when setting object array properties

Hello,


I've tried several different ways to solve this issue but I keep getting a 
"java.util.ConcurrentModificationException" every time I try to loop over the 
properties of a bean. Here are the (hopefully) relevant code snipites:

In the JSP:

        <s:form beanclass="accounts.actions.ShowStatementActionBean">

 <c:forEach items="${actionBean.shortList}" var="inv" varStatus="loop">

     <tr>  <td>${inv.line.invoiceNum}</td></tr>

     <tr><s:text name="shortList[${loop.index}]"></s:text></tr>

</c:forEach>

</table>

</s:form>



The result is this exception:

WARNING: ApplicationDispatcher[/Public] PWC1231: Servlet.service() for servlet 
jsp threw exception

java.util.ConcurrentModificationException

        at 
java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)

        at java.util.AbstractList$Itr.next(AbstractList.java:343)

        at 
org.apache.taglibs.standard.tag.common.core.ForEachSupport$SimpleForEachIterator.next(ForEachSupport.java:149)

        at 
org.apache.taglibs.standard.tag.common.core.ForEachSupport.next(ForEachSupport.java:171)

        at 
javax.servlet.jsp.jstl.core.LoopTagSupport.doAfterBody(LoopTagSupport.java:326)

  ....



I'm fairly new to Stripes (and JSP development in general) so I'm sure it's 
something simple but I can't seem to figure out what..



Thanks,


David Hamilton
Web Coordinator
(615) 843-3337
Hermitage Lighting Gallery
www.hermitagelighting.com<http://www.hermitagelighting.com>

********************************************
[cid:~WRD000.jpg]
Please do not print this e-mail unless necessary

Printing email can cost more than you think. Learn more on our website: 
http://www.hermitagelighting.com/printing_email.php

The information transmitted in this email is intended solely for the individual 
or entity to which it is addressed and may contain confidential and/or 
privileged material. Any review, retransmission, dissemination or other use of 
or taking action in reliance upon this information by persons or entities other 
than the intended recipient is prohibited. If you have received this email in 
error please immediately notify us by reply email to the sender. You must 
destroy the original material and its contents from any computer.
********************************************

<<inline: ~WRD000.jpg>>

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to