• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Indexed Properties hidden values in ActionForm

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have RelationshipDefineDTO object with set/get methods & ArrayList for relAcctDTO objects(RelationAccountDTO) i.e for every RelationshipDefineDTO they are many relAcctDTO objects(RelationAccountDTO)

My requirement is to carry all these fields as hidden parameters from page to page,
i am able to carry all the hidden values of the RelationshipDefineDTO object e.g (clientName, clientID etc) but having problems carring ArrayList values for RelationshipDefineDTO object. Below is what I am doing & any input is appreciated

Code from ActionForm to carry index values


Code for the Object


Code for JSP
<logic:notEmpty name='relationshipForm' property='relDefineDTOList'>
<logic:iterate id='relDefineDTO' name='relationshipForm' property='relDefineDTOList' indexId="index">
<html:hidden name="relDefineDTO" property="clientId" indexed="true" />
<html:hidden name="relDefineDTO" property="clientName" indexed="true" />
<html:hidden name="relDefineDTO" property="clientType" indexed="true" />
<html:hidden name="relDefineDTO" property="cltOrNonCltIndicator" indexed="true" />
<TR>

<TD valign="top" align='Left' nowrap >
<bean:write name='relDefineDTO' property='clientName' />
</TD>
<TD valign="middle" align='center'>
<bean:write name='relDefineDTO' property='clientId' />
</TD>
<TD valign="middle" align='center'>
<bean efine id="primInd" name="relDefineDTO" property="clientRelToPrimary" type="java.lang.String"/>
</TD>

//display relAcctDTO of RelationAccountDTO object

<logic:iterate id="relAcctDTO" name="relDefineDTO" property="relAcctDTO" indexId="acct">
<html:hidden name="relAcctDTO" property="oldWorldNumber" indexed="true" /
<html:hidden name="relAcctDTO" property="accountNumber" indexed="true" />
<html:hidden name="relAcctDTO" property="acctIndicator" indexed="true" />
<TD valign="middle" align='left'>
<bean:write name='relAcctDTO' property='oldWorldNumber'/>
</TD>
<TD valign="middle" align='left'>
<bean:write name='relAcctDTO' property='shortName' /></TD>
<TD valign="middle" align='left'>
<bean:write name='relAcctDTO' property='portfolio' /></TD>
<TD valign="middle" align='left'>
<bean:write name='relAcctDTO' property='accountValue' /></TD>

</logic:iterate>
</TR>

</logic:iterate>
</logic:notEmpty>

Below is the data i am getting for each individual client ids
i.e for every client i am getting the same accountDTO list repeating,
HOW CAN I FIX THIS ISSUE, what am doing wrong?


cltId= 5576283400 cltName= Ellin, Charles relToPrimary= 0 cltInd= 0
AccountNumber= 6890963100 OldWorldNumber = AX 96765 AcctIndicator = I
AccountNumber= 3401963100 OldWorldNumber = AX 96766 AcctIndicator = I
AccountNumber= 9212963100 OldWorldNumber = AX 96767 AcctIndicator = I
AccountNumber= 5312963100 OldWorldNumber = AX 96768 AcctIndicator = I

cltId= 1226283400 cltName= Ellin, Christine relToPrimary= 29 cltInd= 0
AccountNumber= 6890963100 OldWorldNumber = AX 96765 AcctIndicator = I
AccountNumber= 3401963100 OldWorldNumber = AX 96766 AcctIndicator = I
AccountNumber= 9212963100 OldWorldNumber = AX 96767 AcctIndicator = I
AccountNumber= 5312963100 OldWorldNumber = AX 96768 AcctIndicator = I

cltId= 471512000 cltName= SMITH, DONNA relToPrimary= 991 cltInd= 0
AccountNumber= 6890963100 OldWorldNumber = AX 96765 AcctIndicator = I
AccountNumber= 3401963100 OldWorldNumber = AX 96766 AcctIndicator = I
AccountNumber= 9212963100 OldWorldNumber = AX 96767 AcctIndicator = I
AccountNumber= 5312963100 OldWorldNumber = AX 96768 AcctIndicator = I

cltId= 5344012000 cltName= SMITH, JAMES relToPrimary= 991 cltInd= 0
AccountNumber= 6890963100 OldWorldNumber = AX 96765 AcctIndicator = I
AccountNumber= 3401963100 OldWorldNumber = AX 96766 AcctIndicator = I
AccountNumber= 9212963100 OldWorldNumber = AX 96767 AcctIndicator = I
AccountNumber= 5312963100 OldWorldNumber = AX 96768 AcctIndicator = I
RelationshipAccountDTO = 4

EXPECTED Result is as below



cltId= 5576283400 cltName= Ellin, Charles relToPrimary= 0 cltInd= 0
AccountNumber= 6890963100 OldWorldNumber = AX 96765 AcctIndicator = I
AccountNumber= 3401963100 OldWorldNumber = AX 96766 AcctIndicator = I
AccountNumber= 9212963100 OldWorldNumber = AX 96767 AcctIndicator = I
AccountNumber= 5312963100 OldWorldNumber = AX 96768 AcctIndicator = I
RelationshipAccountDTO size = 4

cltId= 1226283400 cltName= Ellin, Christine relToPrimary= 29 cltInd= 0
AccountNumber= 3244963100 OldWorldNumber = AX 94445 AcctIndicator = I
AccountNumber= 4356963100 OldWorldNumber = AX 96556 AcctIndicator = I
RelationshipAccountDTO size = 2

cltId= 471512000 cltName= SMITH, DONNA relToPrimary= 991 cltInd= 0
AccountNumber= 9090955500 OldWorldNumber = AX 94555 AcctIndicator = I
RelationshipAccountDTO size = 1

cltId= 5344012000 cltName= SMITH, JAMES relToPrimary= 991 cltInd= 0
AccountNumber= 8895533100 OldWorldNumber = AX 90965 AcctIndicator = I
RelationshipAccountDTO size = 1
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're iterating over more than one level, you can't use the indexed="true" attribute in an <html:xxx> tag. You must either use the <nested:xxx> tags or construct the property name yourself. I personally prefer to construct the property name myself. Example:


[ March 15, 2007: Message edited by: Merrill Higginson ]
 
Sara Smith
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Merrill,

Thanks a lot for your response.

I get below error message

No getter method for property relDefineDTO[0].relAcctDTO[0].oldWorldNumber of bean org.apache.struts.taglib.html.BEAN



 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The indexed getter method getRelAcctDTO(index) must not be on your form bean but on the RelationshipDefineDTO bean. Because Struts sometimes has a hard time dealing with overloaded methods, it's best if you rename the existing getRelAcctDTO method that returns an ArrayList.

Do you understand why this is? When the form is submitted, the indexed property name above is telling Struts to perform the following actions:
  • Call getRelDefineDTO(0) on the form bean
  • On the bean retrieved from the previous operation, call getRelAcctDTO(0)
  • On the bean retrieved from the previous operation, call setOldWorldNumber("value")


  • [ March 15, 2007: Message edited by: Merrill Higginson ]
     
    We're all out of roofs. But we still have tiny ads:
    Smokeless wood heat with a rocket mass heater
    https://woodheat.net
    reply
      Bookmark Topic Watch Topic
    • New Topic