[Opensource] Need a Jsp tag combination that works,
iterate Blocks within a Bl ock
Michael Rimov
rimovm at centercomp.com
Tue Feb 18 16:36:18 PST 2003
At 12:12 PM 2/18/2003 -0500, you wrote:
>I've got a Block that contains Blocks that I need to iterate through.
>
>Something like Block named "ListBlock" with a set of "EntryBlock" Blocks
>inside it. The Block "ListBlock" is added directly to the response.
>
>How do I iterate through them without using the soon to be deprecated
><Expresso:xxx> tags? I am trying to primarily use the extended Struts tags
>or normal Struts tags, and as a backup: JSTL.
>
>
>I am thinking that logically something this should work:
>
><bean:define id="outerBlock" property="ListBlock"/>
>
><logic:iterate id="innerBlock" name="outerBlock" property="blocks">
> Use the inner block here...
></logic:iterate>
Lets assume each innerBlock has an output named "O"
Try something more like:
<logic:iterate id="innerBlock" property="outerBlock">
<bean:write name="innerBlock" property="/O"/> (or "/O.content")
</logic:iteratate>
[The expresso extensions use an XPath-like notation, so to get the
Attribute 'abcd' from O you'd do:]
<bean:write name="innerBlock" property="/O at abcd"/>
The struts extensions automatically assume ControllerResponse as the base
bean and using logic:iterate you can go through nested tags.
Sometimes in my own programming I get confused whether I need to
<bean:write name="innerBlock"/>
<bean:write name="innerBlock" property="/O"/>
or
<bean:write name="innerBlock" property="O"/>
Each one has different semantics for nesting, but with your block within
the block, logic iterate will give you the subblock with each iteration.
When you're trying to tackle them, I'd recommend:
1 - Execute DBMaint to list a table, but add style=xml&xsl=NONE to the URL
to get an XML formatted output of the ControllerElements.
2 - Take a look at the jsps for the list page to see how each tag accessed
a ControllerElement in the hierarchy.
HTH!
-Mike
More information about the Opensource
mailing list