hello again,
I guess that using  

private Set geSectionGroupComments;

is not a good way to do it, as a Set is not really indexable. I mean, you can't 
really do geSectionGroups[0].geSectionGroupComments[0].geComment.remark if 
geSectionGroupComments is a Set?

I tried to change all my Sets to Lists (I'm using Hibernate to map my 
database), as Lists are indexable. But as Hibernate requires me to set which 
column I wish to use for indexing, I do not get indexes 0,1,2,3... Instead, I 
can get indexes 47, 84 etc. So, when using nested:iterate, it seems like Struts 
assume that all indexes start at 0. Hence, my iteration fails badly... Any way 
to prevent this?

Any solutions???

cheers,
Per


-----Opprinnelig melding-----
Fra: Per Jørgen Walstrøm 
Sendt: 23. november 2005 11:43
Til: user@struts.apache.org
Emne: nested:iterate and setting of parameter

hello,
I use Struts 1.2.7 and in my jsp, I have the following nested elements:

<nested:iterate id="sectionGroupElement" name="crudOutageForm" 
property="geSectionGroups">
   <nested:iterate id="sectionGroupCommentsElement" name="sectionGroupElement" 
property="geSectionGroupComments">       
      <bean:message key="crudOutage.comment"/>:
      <nested:textarea name="sectionGroupCommentsElement" 
property="geComment.remark"/> 
   </nested:iterate>
</nested:iterate>

my form, crudOutageForm, contains the following fields, with getters and 
setters:
private Collection geSectionGroups;

this collection contains objects of GeSectionGroup. In GeSectionGroup.java, I 
have the following field (with getter and setter):
private Set geSectionGroupComments;

geSectionGroupComments contains objects of GeSectionGroupComment. In 
GeSectionGroupComment.java, I have the following field (with getter and setter):
private GeComment geComment;

GeComment.java contains
private String remark;

It is this 'remark' I am trying to set, but I am not succeeding in doing so. 
When submitting my form, the request parameter is named "geComment.remark", and 
this of course has no setter in my crudOutageForm. I tried to use the 
indexed=true attribute, like this

<nested:textarea indexed="true" name="sectionGroupCommentsElement" 
property="geComment.remark"/>

The request parameter is then named 
"sectionGroupCommentsElement[0].geComment.remark", which also is not 
sufficient. I would need something like 
geSectionGroups[0].geSectionGroupComments[0].geComment.remark

I may be naive, but I was kind of hoping for Struts to be able to set that 
"remark"-parameter automagically. Obviously, it doesn't ;-(

Any suggestions?

best regards,
Per



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