Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > struts indexed question

Reply
Thread Tools

struts indexed question

 
 
Tim B
Guest
Posts: n/a
 
      02-01-2006
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">







 
Reply With Quote
 
 
 
 
Tim B
Guest
Posts: n/a
 
      02-01-2006
oops - made a typo - last textbox is textbox 4, not 3


 
Reply With Quote
 
 
 
 
Tim B
Guest
Posts: n/a
 
      02-03-2006

"Tim B" <(E-Mail Removed)> 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


 
Reply With Quote
 
rajeshseetharam rajeshseetharam is offline
Junior Member
Join Date: Feb 2008
Posts: 1
 
      02-05-2008
Quote:
Originally Posted by Tim B
"Tim B" <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
struts <html:text> indexed tricks Indudhar Java 1 08-27-2005 12:47 PM
Struts Indexed Properties servlette Java 0 06-09-2005 06:32 PM
Re: Struts iterate indexed nested objects Stratocaster Java 1 11-11-2004 06:10 PM
Struts, Problems with 'indexed (nested) properties' in ActionForm Rode Java 0 10-09-2003 05:06 PM
struts radio indexed field Pavel Java 1 09-22-2003 03:53 PM



Advertisments