struts indexed question

T

Tim B

Can anyone point me to an example of using Struts indexed properties in a
situation with a formbean contaning a list of objects, each containing a
further list of objects, or point out if there is an error in the code
below? I would like to be able to round-trip to the server with full
repopulation without having to resort to doing what I did for textbox 4.

I have the following code in a jsp

<logic:iterate id="bean" name="myFormBeanName"
property="beanList" type="mypackage2.OuterBean"
scope="request" indexId="ind">

<%-- these 2 textboxes repopulate correctly --%
<html:text name="bean" property="label" indexed="true" />
<html:text name="bean" property="value" indexed="true"/>

<logic:iterate id="nestedBean" name="bean" property="nestedBeanList"
type="mypackage2.NestedBean" indexId = "ind2" >

<%-- textbox 3- this textbox repopulates correctly --%>
<input type="text"

name="bean[<%=ind.intValue()%>].nestedBean[<%=ind2.intValue()%>].beanValue"
value="<%=nestedBean.getBeanValue()%>"/>

<%-- textbox 3- this textbox does not repopulate correctly --%>
<html:text name="nestedBean" property="beanValue" indexed="true"/>
</logic:iterate>

</logic:iterate>


the html generated for textbox 3 is :
<input type="text" name="bean[0].nestedBean[0].beanValue" value="foo"/>

the html generated for textbox 4 is:
<input type="text" name="nestedBean[0].beanValue" value="foo">
 
T

Tim B

Tim B said:
Can anyone point me to an example of using Struts indexed properties in a
situation with a formbean contaning a list of objects, each containing a
further list of objects, or point out if there is an error in the code
below?

answering my own question here - the <html:text> tag and its kin do not
support indexing beyond one level. So I wrote my own version that does
 
Joined
Feb 5, 2008
Messages
1
Reaction score
0
what is the version boy

Tim B said:
"Tim B" <[email protected]> wrote in message
news:qWYDf.299205$tl.284629@pd7tw3no...
> Can anyone point me to an example of using Struts indexed properties in a
> situation with a formbean contaning a list of objects, each containing a
> further list of objects, or point out if there is an error in the code
> below?


answering my own question here - the <html:text> tag and its kin do not
support indexing beyond one level. So I wrote my own version that does

whjat is the version boy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top