Think that the answer you're looking for, is that your tags aren't quite 
set up properly. There's work around of a work around. The child tags 
need to work of the bean that is the current object returned from the 
iterate tag, which is why the properties wont work. They also need to 
get the index from the iterate tag.

1) To get the bean from the iterate tag, you need to set an "id" 
attribute, (you did that, but weren't using it. Almost there :)
2) To get the properties working, the child tags need to address this 
bean in the name attribute.
3) To get the indexing, the child tags need to be told they're indexed 
with indexed="true"


For Example...
<logic:iterate id="rowBean" name="histLstForm" property="myListProperty">
  <tr>
    <td><bean:write name="rowBean" property="question" indexed="true"/></td>
    <td><bean:write name="rowBean" property="ans"      indexed="true"/></td>
    <td><bean:write name="rowBean" property="dateCont" indexed="true"/></td>
    <td><bean:write name="rowBean" property="typ"      indexed="true"/></td>
    <td><bean:write name="rowBean" property="cost"     indexed="true"/></td>
  </tr>
</logic:iterate>

...personally, it's a whole lot of mess to have to account for. If 
you're using Struts 1.1b, you already have access to the nested tags, 
which look after each other in a much easier way. No need for special 
beans or indexed="true" properties. Here's the same thing with nested 
tags...

Example...
<nested:iterate property="myListProperty">
  <tr>
    <td><nested:write property="question"/></td>
    <td><nested:write property="ans"     /></td>
    <td><nested:write property="dateCont"/></td>
    <td><nested:write property="typ"     /></td>
    <td><nested:write property="cost"    /></td>
  </tr>
</nested:iterate>


...a little easier, because the reference to the current tag is supplied 
by the parent tag. So, the child tags will get the index, mapped 
property, or whatever. And if you're on Struts 1.0/1.0.1 then you can 
get the tags and tutorials and such from http://www.keyboardmonkey.com/next

Anyways, one of these should get you working again.


Arron.


vivek shrivastava wrote:

> Hi,
>
> i need help to understand following code. i understand that 
> "histLstForm" is the name of form bean. but i don't understand how 
> does <bean:write> know that there are multiple vales of "question" 
> property of "histLstForm" bean?
>
> How does it perform a loop on all the values of "question" property of 
> "histLstForm" bean? because it it calls getter funtion on "question" 
> property it will give one value, so how does it know there are 
> multiple values?
>
> Following code is from vic's DB sample.
>
> <logic:iterate id="i" name="histLstForm">
> <tr><td>
> <bean:write name="histLstForm" property="question"/></td><td>
> <bean:write name="histLstForm" property="ans"/></td><td>
> <bean:write name="histLstForm" property="dateCont"/></td><td>
> <bean:write name="histLstForm" property="typ"/></td><td>
> <bean:write name="histLstForm" property="cost"/></td>
> </tr>
> </logic:iterate>
> </table>
>
>
>
> Please do help me.
>
> thanks
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>
> -- 
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
>
>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to