You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Danieleippoliti@libero.it" <Da...@libero.it> on 2008/04/14 18:02:00 UTC

Hi,

I have a bean which have a variable List l, this list is readed from a JSP to show the elements.
But I would to show each elements in a different side in the HTML page so when i write <s:iterator value="l"  i would specify the range of iteration (the first two elements...)
So I can have the elements in different side of page.

I'm afraid for my english
regards.

Daniele


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Posted by Dave Newton <ne...@yahoo.com>.
--- "Danieleippoliti@libero.it" <Da...@libero.it> wrote:
> I have a bean which have a variable List l, this list is readed from a JSP
> to show the elements.
> But I would to show each elements in a different side in the HTML page so
> when i write <s:iterator value="l"  i would specify the range of iteration
> (the first two elements...)
> So I can have the elements in different side of page.

The <s:iterator...> tag is limited in capability; you might want to use
JSTL's <c:forEach...>.

Or you can use the "status" attribute to make formatting decisions based on
the index, for example:

<%-- Pseudocode! Do not copy verbatim! --%>
<s:iterator value=... status="stat">
  <s:if test="stat.index % 1 == 1">
    </tr>
    <tr>
  </s:if>
</s:iterator>

or something similar depending on your needs.

Another option is to do the list manipulation in the action, creating
multiple lists for the view, and iterate over them in the JSP. This can be
done using a regular iterator tag, or the <s:merge...> tag [1] could be used.

There are plenty of options ;)

> I'm afraid for my english

I'm afraid for *my* English, and in theory, it's my native language... and I
guarantee you that your English is far, far better than my Italian.

Dave

[1] http://struts.apache.org/2.x/docs/merge.html


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org