struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <newton.d...@yahoo.com>
Subject Re: Problem developing a tag using Struts 2 Arch for Tags
Date Tue, 04 Dec 2007 13:18:28 GMT
--- victor sosa <victornsosa@gmail.com> wrote:
> Yes, I did see the S2 iterator tag, I see that 
> there isn't any while or for into the code, I 
> suppose that the code repeat using the return 
> of the method. but How to uses it? I try twice 
> but the code never iterate using the return 
> value of the #start() and #end() method

I'm not sure what you mean by "using the return
value..." of the start() and end() methods.

Start() and end() return booleans indicating whether
or not the tag should "continue" its operations. The
start() method is what creates the iterator (and saves
it for future reference). It then checks if there are
objects to iterate over, if it does, it pushes the
"next" (in this case, the first) object onto the
stack.

End() does the same thing; this is where (AFAICT) the
bulk of the iteration is done. When there aren't any
objects left to iterate over it does some cleanup and
goes away.

What in particular isn't clicking for you?

This aside, I'm not sure why you're creating a JSON
object like this. There are several JSON libraries
already available for both Java and JavaScript that
will create JSON representation via a single method
call.

d.


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


Mime
View raw message