> -----Original Message-----
> From: Michael McGrady [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 13, 2004 2:53 PM
> To: Struts Users Mailing List
> Subject: How Flexible are Struts and El Tags?
> 
> 
> Using the standard JSP tags, we can pretty do much do 
> anything on a page, e.g.:
> 
> <%
> List list = new TreeList();
> list.add("first");
> list.add("second");
> 
> Iterator iter1 = list.iterator();
> 
> while(iter2.hasNext()) {
>          List list = someMapA.get(iter.next());

The nested map is what proves interesting, as I think you have to drop to a scriptlet 
at this point for the get( iter.next()) bit.
Either <logic:iterate or <c:forEach will have no problem controlling your loop.

>          lIterator iter2 = list.iterator();
>          while(iter2.hasNext()) { %>
>                  <%= "<someTag value=" + iter2.next() %>
>      <% }

Depends on the tag you're using.  <bean:write will also work instead of a scriptlet.  
You might be 
able to use the JSTL ${value}.

>          list = someMapB.get(iter.next());
>          iter2 = list.iterator();
>          while(iter2.hasNext()) { %>
>                  <%= "<someTag value=" + iter2.next() %>
>      <% }
> }
> %>
> 
> Can you do this with el or struts tags, assuming that the 
> needed objects 
> are in scope?  I don't mean to ask whether you can write a tag to do 
> this.  I know we can. I mean to ask whether the existent tags 
> allow this 
> flexibility.

In general, when I find an object graph this complex I try to detangle it in the 
action class before handing
it off to the jsp page to do that.  THat prevents a lot of such code, and makes it 
easier to code the JSP.  However, the drawback is that it ties the jsp to the action 
if you're not careful.
In this case, I would probably just put the entire value list in request scope for the 
jsp page to iterate through, rather then try to do that in the page.

> 
> Thanks!
> 

Nope, not tanks.... just words..... :)

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

Reply via email to