WOOgnl and numbers

24 views
Skip to first unread message

mbla...@gmail.com

unread,
Aug 24, 2007, 5:09:17 AM8/24/07
to wotips
Hi

I'm having trouble finding the correct way to bind a number (instead
of a string) to a component like this:

<wo:ctextfield canEdit="$canEdit" value="$host" size="30" />

in this situation the binding size set to the string '30' which of
course will give this exception:
java.lang.IllegalArgumentException: While trying to set the field
"size" on an object of type CMSTextField we expected a
java.lang.Integer but received a java.lang.String with a value of 30.
This often happens if you forget to use a formatter.

<wo:ctextfield canEdit="$canEdit" value="$host" size="~30" />

in this situation the binding size is correctly set to the number 30,
but the following exception is thrown:

Caused by: ognl.InappropriateExpressionException: Inappropriate OGNL
expression: 30

<wo:ctextfield canEdit="$canEdit" value="$host" size="~(int)30" />

this causes ognl.ExpressionSyntaxException: Malformed OGNL expression:
(int)30

If you could point me in the right direction for casting/specifying
types I would be most great full.

Thanks,
Michael

Mike Schrag

unread,
Aug 24, 2007, 9:01:31 AM8/24/07
to wot...@googlegroups.com
try size = "$30". $ TECHNICALLY means, "evaluate this as if there
were no quotes and this was in a wod file", so

<wo:whatever size = "$30"/>

is

Unnamed : whatever {
size = 30;
}

This is just like how you would also do $true, $false, and
$^someBinding.

ms

mbla...@gmail.com

unread,
Aug 27, 2007, 11:37:48 AM8/27/07
to wotips
Hi Mike

Had a different understanding of the $-sign. Makes perfect sense now.

Thanks,
Michael

On Aug 24, 3:01 pm, Mike Schrag <msch...@mdimension.com> wrote:
> try size = "$30". $ TECHNICALLY means, "evaluate this as if there
> were no quotes and this was in a wod file", so
>
> <wo:whatever size = "$30"/>
>
> is
>
> Unnamed : whatever {
> size = 30;
>
> }
>
> This is just like how you would also do $true, $false, and
> $^someBinding.
>
> ms
>

Reply all
Reply to author
Forward
0 new messages