You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ken in Nashua <kc...@live.com> on 2011/09/16 04:00:46 UTC
outputting expression logic
Hi All,
I have this expression in a component definition...
<t:label for = "tableColumnsSelect"> ${cursor} + 1 </t:label>
For my case cursor is initially 0
After render... I view page source and I see the following...
0 + 1
when what I actually wanted to see is... the sum of the expression and the value rendered...
1
Any tips on how i can do this ? Is there an arithmetic or expression operator that I can prefix before my "${cursor} + 1" ?
Thanks
Re: outputting expression logic
Posted by Steve Eynon <st...@alienfactory.co.uk>.
Some call it clutter, I call it refactor safe!
A problem I often saw with T4 is people tended to push as much logic
as they could into the .tml - with the pain they encountered
afterwards, I wondered why they didn't just stick to JSPs?!
And
<t:outputRaw value=" (${cursor} + 1) "/>
does nothing more than
${cursor} + 1
as all outputRaw does is evaluate your expression and write out as
raw, un-escaped HTML.
Steve.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: outputting expression logic
Posted by Ken in Nashua <kc...@live.com>.
So far I have to clutter up my component with this...... wish I could just do it in the tml like ognl as-is in t-4.1.2
not interested in chenelle
@Persist("session")
@Property
private int cursorStartPosition;
@Persist("session")
@Property
private int cursorEndPosition;
@Persist("session")
@Property
private int collectionSize;
@BeginRender
public void beginRender()
{
itemsPerPage = 50;
tableColumns = 3;
/**
* auto paging metrics
*/
cursorStartPosition = cursor + 1;
cursorEndPosition = cursor + (collection == null ? 0 : java.lang.Math.min(collection.size(), itemsPerPage));
collectionSize = (collection == null ? 0 : collection.size());
}
kcolassi@live.com
From: kcolassi@live.com
To: users@tapestry.apache.org
Subject: RE: outputting expression logic
Date: Thu, 15 Sep 2011 22:53:18 -0400
I guess I am asking for an ognl engine... to do these calculations within tml files
be nice if there were an expression operator in T5 to do these...
guess I will have to make a java method...
any solutions or canonical approach are appreciated...
kcolassi@live.com
From: kcolassi@live.com
To: users@tapestry.apache.org
Subject: RE: outputting expression logic
Date: Thu, 15 Sep 2011 22:47:03 -0400
<t:outputRaw value=" (${cursor} + 1) "/>
this seems to produce "0 + 1" instead of the desired "1"
all i am trying to do is have the arithmetic performed before the output
thanks
kcolassi@live.com
From: kcolassi@live.com
To: users@tapestry.apache.org
Subject: outputting expression logic
Date: Thu, 15 Sep 2011 22:00:46 -0400
Hi All,
I have this expression in a component definition...
<t:label for = "tableColumnsSelect"> ${cursor} + 1 </t:label>
For my case cursor is initially 0
After render... I view page source and I see the following...
0 + 1
when what I actually wanted to see is... the sum of the expression and the value rendered...
1
Any tips on how i can do this ? Is there an arithmetic or expression operator that I can prefix before my "${cursor} + 1" ?
Thanks
RE: outputting expression logic
Posted by Ken in Nashua <kc...@live.com>.
I guess I am asking for an ognl engine... to do these calculations within tml files
be nice if there were an expression operator in T5 to do these...
guess I will have to make a java method...
any solutions or canonical approach are appreciated...
kcolassi@live.com
From: kcolassi@live.com
To: users@tapestry.apache.org
Subject: RE: outputting expression logic
Date: Thu, 15 Sep 2011 22:47:03 -0400
<t:outputRaw value=" (${cursor} + 1) "/>
this seems to produce "0 + 1" instead of the desired "1"
all i am trying to do is have the arithmetic performed before the output
thanks
kcolassi@live.com
From: kcolassi@live.com
To: users@tapestry.apache.org
Subject: outputting expression logic
Date: Thu, 15 Sep 2011 22:00:46 -0400
Hi All,
I have this expression in a component definition...
<t:label for = "tableColumnsSelect"> ${cursor} + 1 </t:label>
For my case cursor is initially 0
After render... I view page source and I see the following...
0 + 1
when what I actually wanted to see is... the sum of the expression and the value rendered...
1
Any tips on how i can do this ? Is there an arithmetic or expression operator that I can prefix before my "${cursor} + 1" ?
Thanks
RE: outputting expression logic
Posted by Ken in Nashua <kc...@live.com>.
<t:outputRaw value=" (${cursor} + 1) "/>
this seems to produce "0 + 1" instead of the desired "1"
all i am trying to do is have the arithmetic performed before the output
thanks
kcolassi@live.com
From: kcolassi@live.com
To: users@tapestry.apache.org
Subject: outputting expression logic
Date: Thu, 15 Sep 2011 22:00:46 -0400
Hi All,
I have this expression in a component definition...
<t:label for = "tableColumnsSelect"> ${cursor} + 1 </t:label>
For my case cursor is initially 0
After render... I view page source and I see the following...
0 + 1
when what I actually wanted to see is... the sum of the expression and the value rendered...
1
Any tips on how i can do this ? Is there an arithmetic or expression operator that I can prefix before my "${cursor} + 1" ?
Thanks
Re: outputting expression logic
Posted by Taha Hafeez <ta...@gmail.com>.
Hi
Tapestry property expressions do not support arithmetic operations. See
http://tapestry.apache.org/property-expressions.html
for complete list of operations supported
On Fri, Sep 16, 2011 at 7:30 AM, Ken in Nashua <kc...@live.com> wrote:
>
> Hi All,
>
> I have this expression in a component definition...
>
> <t:label for = "tableColumnsSelect"> ${cursor} + 1 </t:label>
>
> For my case cursor is initially 0
>
> After render... I view page source and I see the following...
>
> 0 + 1
>
> when what I actually wanted to see is... the sum of the expression and the value rendered...
>
> 1
>
> Any tips on how i can do this ? Is there an arithmetic or expression operator that I can prefix before my "${cursor} + 1" ?
>
> Thanks
>
--
Regards
Taha Hafeez Siddiqi (tawus)
http://tawus.wordpress.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org