my Arraylist has got a variable size.
so, i've put in the required action declarations(in struts-config.xml), the 
DynaActionForm in session scope, and it works!!!!!!!!!
thanks a lot richard for your help!
best regards,
charles.


-------- Message original -------- Sujet:  Re: dynaActionForm,JSTL, and indexed 
properties 
Date:  Thu, 4 Dec 2003 15:51:25 -0800 (PST) 
De:  Richard Yee <[EMAIL PROTECTED]> 
Pour:  Struts Users Mailing List <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 



Charles,
If you the size of the ArrayList is constant, you can
specify the form-property 'size' attribute and this
will fix your problem. Otherwise, you need to use
session scope to store the FormBean. The reason is
that Struts will not size the colRequetes ArrayList
when the form is submitted. If the form is in request
scope, it will already be sized for you.

-Richard

--- Charles GAY <[EMAIL PROTECTED]> wrote:
> hi all.
> i have in my DynaValidatorForm called entrantesForm,
> declared an ArrayList (called colRequetes) of 

> RequeteTO objects.
> <form-property name="colRequetes"
> type="java.util.ArrayList" /></form-bean>
> 
> in my jsp, i want to update some properties of
> RequeteTO, like 'typeRequete' with the
> html-tag(html-el taglib declared above) with the
> <html:selec>t tag.
> 
>   <c:forEach 
> items="${entrantesForm.map.colRequetes}"
> var="enregistrement" varStatus="status">
>   <c:set var="numero" value="${status.index}"
> scope="page" />  
>   <tr>
>       <td><html:radio property="id"
> value="${enregistrement.id}"  /></td>
>     <td><c:out value="${enregistrement.nomRequete}"
> /></td>
>     <td><c:out value="${enregistrement.typeObjet}"
> /></td>    
>       <td><html:select size="1"  name="colRequetes"
> property="typeRequete" indexed="true"
> value="${enregistrement.typeRequete}" >
>                 <html:option value="Publique" >
>                       <c:if test="${enregistrement.typeRequete ==
> 'Publique'}"><c:out 
> value="${enregistrement.typeRequete}" /></c:if>
>                 </html:option>
>                 <html:option value="Privée" >
>                       <c:if test="${enregistrement.typeRequete ==
> 'Privée'}"><c:out 
> value="${enregistrement.typeRequete}" /></c:if>
>                 </html:option>
>               </html:select >
>       </td>
>   </tr>
>   </c:forEach>
> 
> the jsp result is good.
> 
> an extract of the html source producted by the jsp:
> <form name="entrantesForm" method="POST"
> action="/comsis/entrantes/EntrantesRequete.do">    
> 
> <table>
>  <tr>
>    <th></th>    
>    <th>Nom de la requete</th>
>    <th>Type dossier</th>  
>    <th>Type requete</th>
>  </tr>
>  
>    
>  <tr>
> <td><input type="radio" name="id" value="13"
> checked="checked" /></td>
>    <td>s</td>
>    <td>entrante</td>    
> <td><select name="colRequetes[0].typeRequete"
> size="1"><option value="Publique"
> selected="selected">Publique</option>
>  <option value="Privée">Privée</option></select>
> </td>
>  </tr>
>  
>    
>  <tr>
> <td><input type="radio" name="id" value="15" /></td>
>    <td>gbgh,gh</td>
>    <td>entrante</td>    
> <td><select name="colRequetes[1].typeRequete"
> size="1"><option value="Publique">Publique</option>
>  <option value="Privée"
> selected="selected">Privée</option></select>
> </td>
>  </tr>
>  
> </table>
> 
> 
> but, when i submit the form,
> the server says that:
> StandardWrapperValve[action]: "Servlet.service()"
> pour la servlet action a généré une exception
> javax.servlet.ServletException: BeanUtils.populate
>       at
>
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
>       at
>
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java: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.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
>       at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
> ........
> ........
> ----- Root Cause -----
> java.lang.IndexOutOfBoundsException: Index: 0, Size:
> 0
>       at
> java.util.ArrayList.RangeCheck(ArrayList.java:507)
>       at java.util.ArrayList.get(ArrayList.java:324)
>       at
>
org.apache.struts.action.DynaActionForm.get(DynaActionForm.java:298)
>       at
>
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:474)
>       at
>
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:428)
>       at
>
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:770)
>       at
>
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801)
>       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(RequestProcessor.java: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.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
>       at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
> .......
> .......
> the collection seems not be initialized, but
> *before* the request, the jsp display his
> content......
> crazy problem.......
> any helps will be very appreciated!!
> 
> thanks in advance,
> charles.
> 
> 
> 
>
---------------------------------------------------------------------
> 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]

Reply via email to