Filipe David Manana-2 wrote:
> 
> Nop. Neither way works.
> 
> <s:iterate value="pageCount">
>   <s:property />
> </s:iterate>
> 
> This has a single iteration, and the value outputted is the value of
> the variable (10 for example).
> 

You can achieve what you expect with the following code in your JSP:

<s:bean name="org.apache.struts2.util.Counter" var="counter">
  <s:param name="last" value="%{pageCount}" />
</s:bean>
<s:iterator value="#counter">
  <s:property />
</s:iterator>

--- OR --- you can publish a Counter directly from your java code
public class TestIterator2 extends ActionSupport {
        Counter counter;
        public Counter getCounter() {
                return counter;
        }
        @Override
        public String execute() throws Exception {
                counter = new Counter();
                counter.setFirst(0);
                counter.setLast(40);
                return SUCCESS;
        }
}

that can be iterated from your JSP like this:
<s:iterator value="counter">
        <s:property />
</s:iterator>

ZartC
-- 
View this message in context: 
http://www.nabble.com/Struts2-tags-loops-tp15216947p19001293.html
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to