Hello folks
2 days ago I wrote:

> from struts-config.xml the definition of the form follows:
>
>
> <form-bean name="canalizzazioneCLDForm"
> type="org.apache.struts.validator.DynaValidatorActionForm">
> <form-property name="listaDanneggiati" type="java.util.ArrayList"/>
> </form-bean>

the definition of the associated action is (note the scope parameter):


<action path="/canalizzazione_cld"
input="/jsp/pagecontainers/canalizzazioneCLD.jsp" scope="request"
name="canalizzazioneCLDForm" parameter="command"
type="it.ggl.callcenter.presentation.controller.action.CanalizzazioneCLDAction">    
<forward name="avanti"
    path="/RISS_FRONTOFFICE/container_frontOffice.jsp" /><forward name="indietro" 
path="/jsp/pagecontainers/controparteveicolo.jsp"
/>     </action>

My approach: I extract from session the bean I use to initialize the form.
I do this in the action which is called before passing the request to the
JSP which implements canalizzazioneCLDForm:
//this bean defines the listaDanneggiati property
PartiteDanneggiatiView partite = new PartiteDanneggiatiView();
// extract from session the bean which returns the listaDanneggiati
ArrayList SessionBeanContainer beanContainer=
getSessionContainer(request);if (beanContainer != null)
{
//this is obvious
  partite.setListaDanneggiati((ArrayList)beanContainer.getListaDanneggiati());}
// puts form into the request
setFormIntoTheRequest("canalizzazioneCLDForm", partite, request);
//....................


Now the request is passed to the JSP:

.............
<html:form method="post" action="/canalizzazione_cld.do">
  <nested:iterate  property="listaDanneggiati" type="DanneggiatoDto">
    <nested:text styleClass="inputText" property="cognome"/><br/>
      <nested:text styleClass="inputText" property="nome"/><br/>
         <nested:iterate property="oggColpiti" type="OggColpitoDto">
           &nbsp;&nbsp;&nbsp;<nested:text styleClass="inputText"
           property="descrizioneGenerica"/><br/>
           &nbsp;&nbsp;&nbsp;<nested:text styleClass="inputText"
           property="tipoGenerico"/><br/>         </nested:iterate>
  </nested:iterate>
</html:form>
................


when I submit the form I get the following


> I need this to manage the interactivity correctly. Infact what I
> actually get when I submit the form is the following:>
> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
>       at java.util.ArrayList.RangeCheck(Unknown Source)
>       at java.util.ArrayList.get(Unknown Source)
>       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........>
>


but if I change the scope of the action above to "session" and I call
setFormIntoTheSession() instead of setFormIntoTheRequest() all works nice.
This is obvius, but my problem is: I don't like to set the action scope to
"session". Is there a way to set it to "request" and let all working
right?

thanks in advance


-- 
Paride Perazzolo
[EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to