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 nashua <nh...@hotmail.com> on 2007/10/12 21:12:14 UTC
Does tapestry need an IntegerPropertySelectionModel ?
I am trying to operate a PropertySelection that uses an array of strings but their content are numbers.
private static final String[] tableSizeOptions = new String[] {
"1", "2", "3"
};
I am assuming OGNL is smart enough to coerce these during render cycle on IF conditions that attempt to perform arithmetic.
NOT the case... see stack trace below.
Do I need to implement an IntegerPropertySelectionModel for this to operate properly?
Best regards
Ken in nashua
2007-10-12 15:01:00,575 [btpool0-2] ERROR org.apache.tapestry.services.impl.HiveMindExpressionCompiler - Error generating OGNL getter for expression (index % tableSize) == 0 with root $Gallery_17@a04f0a81[Home/galleryWidget] and body:
{ return ($w) ((ognl.OgnlOps.equal( ($w) ((($Gallery_17)$2).getIndex() % (($Gallery_17)$2).getTableSize() ), ($w) 0)));}
org.apache.hivemind.ApplicationRuntimeException: Unable to add method java.lang.Object get(ognl.OgnlContext, java.lang.Object) to class $ASTEq_1159596f3b2: [source error] invalid types for %
at org.apache.tapestry.enhance.ClassFabImpl.addMethod(ClassFabImpl.java:278)
at org.apache.tapestry.services.impl.HiveMindExpressionCompiler.compileExpression(HiveMindExpressionCompiler.java:176)
at ognl.OgnlRuntime.compileExpression(OgnlRuntime.java:523)
_________________________________________________________________
Windows Live Hotmail and Microsoft Office Outlook – together at last. Get it now.
http://office.microsoft.com/en-us/outlook/HA102225181033.aspx?pid=CL100626971033
Re: Does tapestry need an IntegerPropertySelectionModel ?
Posted by Jesse Kuhnert <jk...@gmail.com>.
I've added a jira issue for OGNL ....I think - but am not sure - that
this should be properly evaluated normally...So, it could be a bug.
You can probably do one of the following:
-) Create a simple inner class def of your IPropertySelectionModel
using an int[] .
-) Wait for me to fix it in OGNL.
-) Replace your "(index % tableSize) == 0" with a method equivalent
that you implement on your page / component so that it turns in to
"ognl:odd" (as in public boolean isOdd(){ return getIndex() %
getTableSize() == 0; }
I'd go for the third option if it were me. Thanks for shortening
down your question for me, I usually have an unofficial automatic
email content limit that makes me skip over them if they are too long
to read easily in a few seconds.
On 10/12/07, Ken nashua <nh...@hotmail.com> wrote:
>
> I am trying to operate a PropertySelection that uses an array of strings but their content are numbers.
>
> private static final String[] tableSizeOptions = new String[] {
> "1", "2", "3"
> };
>
> I am assuming OGNL is smart enough to coerce these during render cycle on IF conditions that attempt to perform arithmetic.
>
> NOT the case... see stack trace below.
>
> Do I need to implement an IntegerPropertySelectionModel for this to operate properly?
>
> Best regards
> Ken in nashua
>
> 2007-10-12 15:01:00,575 [btpool0-2] ERROR org.apache.tapestry.services.impl.HiveMindExpressionCompiler - Error generating OGNL getter for expression (index % tableSize) == 0 with root $Gallery_17@a04f0a81[Home/galleryWidget] and body:
> { return ($w) ((ognl.OgnlOps.equal( ($w) ((($Gallery_17)$2).getIndex() % (($Gallery_17)$2).getTableSize() ), ($w) 0)));}
> org.apache.hivemind.ApplicationRuntimeException: Unable to add method java.lang.Object get(ognl.OgnlContext, java.lang.Object) to class $ASTEq_1159596f3b2: [source error] invalid types for %
> at org.apache.tapestry.enhance.ClassFabImpl.addMethod(ClassFabImpl.java:278)
> at org.apache.tapestry.services.impl.HiveMindExpressionCompiler.compileExpression(HiveMindExpressionCompiler.java:176)
> at ognl.OgnlRuntime.compileExpression(OgnlRuntime.java:523)
>
>
> _________________________________________________________________
> Windows Live Hotmail and Microsoft Office Outlook – together at last. Get it now.
> http://office.microsoft.com/en-us/outlook/HA102225181033.aspx?pid=CL100626971033
--
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