Em Thu, 24 Sep 2009 14:23:12 -0300, Gunnar Eketrapp
<gunnar.eketr...@gmail.com> escreveu:
Hi!
Hi!
It's not that simple ...
The level is displayd as (idx+1) and i dont even have acess to the index
or do I?
Loop's index parameter is the solution.
In your class:
@Property
private int index;
public getLineNumber() {
return index + 1;
}
Then, in your template:
${lineNumber}
When using Tapestry, think that you do boolean or not null tests in the
template. Everything eles is better done in the page or component class.
The class="tdalt" that is rendered on each second line can be solved by
methods.
But I haven't come up with a solution for the index and index+1 problem.
They are also solved by methods. See above.
Or am I stupid? Perhaps there is something that I have not grasped ...
You're not stupid at all. You're just learning a new framework that does
things very differently (and way better than) than JSP and Struts.
I gave up and solved it with a method + outputRaw. I also made a
component for some other case.
Nice to know that you're a Tapestry newbie but already implemented your
own components. That's a success story for T5. :)
But it would be nice if simple loops like this could be achieved in TML.
Don't forget that putting logic in your template is always a bad thing
(lack of separation of concerns and MVC violation), unless it's looping or
doing simple conditionals.
--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org