aspose file tools*
The moose likes Struts and the fly likes Nested:iterate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Nested:iterate" Watch "Nested:iterate" New topic
Author

Nested:iterate

Mercedes Bernal
Greenhorn

Joined: Nov 30, 2007
Posts: 4
I'm writting here again, because I have not any response and I have the problem yet.
I've a problem with nested:iterate. I've written some code to iterate around a collection of objects; these objects have a ArrayList property (movLine), and I would like to iterate around this property too, like this:

<nested:iterate "object1">
<nested:iterate "movLine property">
</nested:iterate>
</nested:iterate>

Can someone post me an example?

Excuse me for my English, because I'm spanish and my english level is basic.

Thanks!!!
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Originally posted by Mercedes Bernal:
Can someone post me an example?



For more information on the nested tags, see this link.


Merrill
Consultant, Sima Solutions
Mercedes Bernal
Greenhorn

Joined: Nov 30, 2007
Posts: 4
First of all, thanks you for your response. I've write the code you posted me, but I get the exception below:

javax.servlet.jsp.JspException: No getter method for property lMov of bean movsAlm

I don't understand this exception because movsAlm is an array of movVO objects which have a property lMov, array property.

Where is the mistake?

Thanks!!
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Pleast post the relevant JSP code as well as code snippets from your ActionForm and other beans so that we can understand how your data is structured.
Mercedes Bernal
Greenhorn

Joined: Nov 30, 2007
Posts: 4
Ok.

The jsp relevant code

<nested:iterate id="elemento" name="movsAlm">
<table>
<thead><tr><th> <bean:message key="almacen.movimiento.numero"/>
</th>
<th>
<bean:message key="pedido.fecha"/></th><th colspan="2"> <bean:message key="almacen.origen"/></th>
<th colspan="2">
<bean:message key="almacen.destino"/></th>
<th>
<bean:message key="ver.mov.coste"/></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<nested:write name="elemento" property="id"/>
</td>
<td>
<nested:write name="elemento" property="fecha"/>
</td>
<td>
<nested:write name="elemento" property="coste"/>
</td>
</tr>
</tbody>
</table>

<nested:iterate name="elemento" id="elemento2" property="lMov">
<nested:iterate name="elemento2" id="elemento3">
<nested:write name="elemento3" property="id"/>
</nested:iterate>
</nested:iterate>
</nested:iterate>


Mmm, in the action:

ArrayList aMovs = new ArrayList();

for(int i=0;i<idMovsAlm.size();i++){
MovimientoVO mVO = new MovimientoVO();
ArrayList aLnMov = new ArrayList();

for(int l=0;l<hExistMov.size();l++){
LineaMovVO lnMov = new LineaMovVO();
lnMov.setId();
lnMov.setNombre();
lnMov.setUnidades();
lnMov.setValorn();
aLnMov.add(lnMov);
}
mVO.setId();
mVO.setFecha();
mVO.setIdAlmO();
mVO.setNombreAlmO();
mVO.setIdAlmD();
mVO.setNombreAlmD();
mVO.setLMov(aLnMov);
mVO.setCoste(coste);
aMovs.add(mVO);
}
request.setAttribute("movsAlm", aMovs);

Ok, if you have another question, don't worry and asqued me please!
Thanks!!
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'm not sure what the last 6 lines of your JSP code is supposed to accomplish, but I'd suggest you just remove them. As best I can understand, here is some code that might work in your situation. However, it's important to understand that I'm only giving you "sample" code" to show you an example of how the tags work and how they interact with each other. Since you're the only one who really knows what you're trying to accomplish, it's up to you to analyze my sample code and see what fits and doesn't fit for your situation.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Nested:iterate