tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paride Perazzolo" <tremaln...@despammed.com>
Subject Using struts-nested tags
Date Mon, 05 Jul 2004 15:46:10 GMT
Hi folks,
I'm new to the list, so forgive me if I'm not respecting Netiquette or
asking off-topics.

I'm trying to render pieces of html using the following syntax:

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>


into the jsp I wrote (MyBeanContainer has the method
getListaDanneggiati() which returns a ArrayList of beans):

<jsp:useBean id="beanContainer" class="com.mycompany.MyBeanContainer"
scope="session"></jsp:useBean>

..............

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



The html I actually get is:


.................
<input type="text" name="listaDanneggiati[0].cognome" value="SDFSDFDS"
class="inputText"><br/> <input type="text"
name="listaDanneggiati[0].nome" value="SDFSDF" class="inputText"><br/>
&nbsp;&nbsp;&nbsp;<input
type="text" name="listaDanneggiati[0].oggColpiti[0].descrizioneGenerica"
value="Trasportato" class="inputText"><br/> &nbsp;&nbsp;&nbsp;<input
type="text" name="listaDanneggiati[0].oggColpiti[0].tipoGenerico"
value="Persona" class="inputText"><br/> &nbsp;&nbsp;&nbsp;<input
type="text" name="listaDanneggiati[0].oggColpiti[1].descrizioneGenerica"
value="COSE" class="inputText"><br/> &nbsp;&nbsp;&nbsp;<input type="text"
name="listaDanneggiati[0].oggColpiti[1].tipoGenerico"
value="Cosa/Animale" class="inputText"><br/> <input type="text"
name="listaDanneggiati[1].cognome" value="SDFSDF" class="inputText"><br/>
<input type="text" name="listaDanneggiati[1].nome" value="SDFSDF"
class="inputText"><br/> &nbsp;&nbsp;&nbsp;<input type="text"
name="listaDanneggiati[1].oggColpiti[0].descrizioneGenerica"
value="Trasportato" class="inputText"><br/> &nbsp;&nbsp;&nbsp;<input
type="text" name="listaDanneggiati[1].oggColpiti[0].tipoGenerico"
value="Persona" class="inputText"><br/> &nbsp;&nbsp;&nbsp;<input
type="text" name="listaDanneggiati[1].oggColpiti[1].descrizioneGenerica"
value="SDFSFSDF" class="inputText"><br/> &nbsp;&nbsp;&nbsp;<input
type="text" name="listaDanneggiati[1].oggColpiti[1].tipoGenerico"
value="Cosa/Animale" class="inputText"><br/>  ...............

which is nice but not satisfying. I'd like to get something like:


<input type="text" name="beanContainer.listaDanneggiati[0].nome"
value="SDFSDF" class="inputText"><br/>

where the name property of the input text includes the root name, ie
"beanContainer".

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........


Thank you in advance...



-- 
Paride Perazzolo
tremalnaik@despammed.com





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


Mime
View raw message