You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andrea Chiumenti <ki...@gmail.com> on 2007/01/24 17:20:50 UTC

Help with ognl

hello,
I have an ognl expression inside a @For component and I'm using tap 4.1.1

"ognl:id + '-cg-' + (index + 1)"

the index is an int property.
I expect the result to be:

comp-cg-1
comp-cg-2
comp-cg-3
etc. but instead I've back

comp-cg-01
comp-cg-11
comp-cg-21

How to sum index + 1 and append the result to the string ?

Of course I could add a method to the java component getIndexPlus1(), but
it's ugly.

Thx,
kiuma

Re: Help with ognl

Posted by Jesse Kuhnert <jk...@gmail.com>.
Sounds like a potential ognl bug as well. The (index + 1) expression
should be interpreted as a separate addition expression from
everything else.

If you would be so kind as to file an issue here:

http://jira.opensymphony.com/browse/OGNL

I can take a look at fixing it during the next release.

On 1/24/07, Andrea Chiumenti <ki...@gmail.com> wrote:
> Thx Richard,
> In your opinion whats better/smarter:
> 1) "ognl:id + '-cg-' + (index * 1 + 1)"
> 2)"ognl:id + '-cg-' + add(index,1)"
>
> ?
>
> On 1/24/07, Richard Clark <rd...@gmail.com> wrote:
> >
> > On 1/24/07, Andrea Chiumenti <ki...@gmail.com> wrote:
> >
> > > "ognl:id + '-cg-' + (index + 1)"
> > >
> > > the index is an int property.
> > > I expect the result to be:
> > >
> > > comp-cg-1
> > > etc. but instead I've back
> > > comp-cg-01
> >
> > It's ugly, but one answer is  "ognl:id + '-cg-' + (index * 1 + 1)",
> > using the multiplication to force interpretation as a number.
> >
> > ...Richard
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

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


Re: Help with ognl

Posted by Andrea Chiumenti <ki...@gmail.com>.
Thx Richard,
In your opinion whats better/smarter:
1) "ognl:id + '-cg-' + (index * 1 + 1)"
2)"ognl:id + '-cg-' + add(index,1)"

?

On 1/24/07, Richard Clark <rd...@gmail.com> wrote:
>
> On 1/24/07, Andrea Chiumenti <ki...@gmail.com> wrote:
>
> > "ognl:id + '-cg-' + (index + 1)"
> >
> > the index is an int property.
> > I expect the result to be:
> >
> > comp-cg-1
> > etc. but instead I've back
> > comp-cg-01
>
> It's ugly, but one answer is  "ognl:id + '-cg-' + (index * 1 + 1)",
> using the multiplication to force interpretation as a number.
>
> ...Richard
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Help with ognl

Posted by Richard Clark <rd...@gmail.com>.
On 1/24/07, Andrea Chiumenti <ki...@gmail.com> wrote:

> "ognl:id + '-cg-' + (index + 1)"
>
> the index is an int property.
> I expect the result to be:
>
> comp-cg-1
> etc. but instead I've back
> comp-cg-01

It's ugly, but one answer is  "ognl:id + '-cg-' + (index * 1 + 1)",
using the multiplication to force interpretation as a number.

...Richard

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