You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Nelson <cn...@yahoo.com> on 2005/08/02 18:22:46 UTC

Re: Foreach with component in Tapestry 4

Hmm, I think your solution looks much nicer.  Seems
more elegant.  I may refactor my code.

--- Adam Czysciak <ad...@gmail.com> wrote:

> Chris Nelson wrote:
> 
> > Yup, that did the trick.  I love it when a problem
> > takes 2 paragraphs to explain and 1 sentence to
> solve
> > :)
> 
> I solved it other way. If myCursor is the 'value'
> binding of Foreach (with
> type cursorType), I made the submit listener with
> signature:
>   public void mySubmit(cursorType currentCursor);
> and then in @Submit, I added "parameters=myCursor"
> binding, and it worked.
> Then, in listener code, I don't have to operate on a
> cursor property, I have
> it passed as a parameter.
> 
> Which is better, Howard? In the sense of Tapestry
> overhead, maybe
> memory/speed overhead?
> 
> 
> -- 
> Greets,
>   Adam Czysciak
>   adam.czysciak@gmail.com
>   Sun Certified Programmer for the Java 2 Platform,
> SE 5
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> 
> 



		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

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


Re: Foreach with component in Tapestry 4

Posted by Nathan Kopp <nk...@mailshell.com>.
Adam Czysciak wrote:

> I'm developing WebObjects for 2 years now, and there the functions operate
> on cursors (behaves like 'defer=false' by default, like it was in tap3).
So
> I'm used to this approach. But, you're right - the parameter looks nicer
> (plus we may add any other ognl expressions as more function parameters!
> it's really cute).
>
> Also, I think that passing parameters may be faster and more efficient, as
> theoretically there is no need to iterate the Foreach to get the cursor (I
> know it iterates it anyway, but it's just theory)


Also, if your listener changes the contents of the list (like deleting the
element that was clicked), then you'll need to use the deferred listener
with a parameter so that the iterator doesn't break in the middle of the
loop after the underlying list has been modified.

-Nathan


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


Re: Foreach with component in Tapestry 4

Posted by Adam Czysciak <ad...@gmail.com>.
Chris Nelson wrote:

> Hmm, I think your solution looks much nicer.  Seems
> more elegant.  I may refactor my code.
I'm developing WebObjects for 2 years now, and there the functions operate
on cursors (behaves like 'defer=false' by default, like it was in tap3). So
I'm used to this approach. But, you're right - the parameter looks nicer
(plus we may add any other ognl expressions as more function parameters!
it's really cute).

Also, I think that passing parameters may be faster and more efficient, as
theoretically there is no need to iterate the Foreach to get the cursor (I
know it iterates it anyway, but it's just theory)

-- 
Greets,
  Adam Czysciak
  adam.czysciak@gmail.com
  Sun Certified Programmer for the Java 2 Platform, SE 5


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