• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Nested:iterate

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!!!
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mercedes Bernal:
Can someone post me an example?




For more information on the nested tags, see this link.
 
Mercedes Bernal
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic