Displaying nested outputs by name
Max <maxxam-cuDQgYkrLFxfAa1EqD/[email protected]>
| Newsgroups | gmane.comp.java.keel.devel |
|---|---|
| Message-ID | <[email protected]> |
I'm having a real hard time understanding how to display nested elements
in Keel. I'm beginning to think that I have misunderstood something
horribly as this should be pretty standard stuff. I remember doing this
quite often using Expresso and having no problems in referencing the
nested outputs by name.
I need to display a table of items. My model code looks something like:
Output table = res.createOutput("table");
res.add(table);
for (int rows = 0; rows < 10; rows++) {
Output row = res.createOutput("row" + rows);
table.add(row);
Output name = res.createOutput("name", "name" + rows);
row.add(name);
Output addr = res.createOutput("addr", "addr" + rows);
row.add(addr);
Output tel = res.createOutput("tel", "tel" + rows);
row.add(tel);
}
I can display this in a jsp page by using:
<c:forEach var="row" items="${table.map['nested']}">
<p><c:out value="${row.map['name']}" default=""/> = <c:out
value="${row.map['content']}" default=""/> </p>
<c:forEach var="output" items="${row.map['nested']}">
<p><c:out value="${output.map['name']}" default=""/> =
<c:out value="${output.map['content']}" default=""/> </p>
</c:forEach>
</c:forEach>
However this simply iterates over all outputs. In my view I wish to
explicitly reference an output, so I would like something like:
<table>
<c:forEach var="row" items="${table.map['nested']}">
<tr>
<td> {display name} </d>
<td> {display tel} </td>
<td> {display addr} </td>
</tr>
</c:forEach>
</table>
Note that I am changing the order of the outputs here.
One solution that will likely work but is so clumsy as to be
unreasonable is to iterate over all the outputs and test each one in a
<c:if> statement to see if it is the output I am looking for. This
solution gets even worse if I have mixed inputs/outputs/commands and now
also need to test the type.
I have tried all sorts of ways to try to reference these nested outputs
by name but can't seem to find a way. I have also tried to write a
struts tag based solution without success. I have also tried nesting the
outputs as attributes using row.setAttribute(...) without success.
Is there a way to do this or have I got the wrong end of the stick and
should be approaching this problem differently?
Thanks for any assistance.
Max
http://keelframework.org/documentation.shtml
Keelgroup mailing list
[email protected]
http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com