I'm migrating an existing project which uses 4.0.2 to use 4.1.2 and I'm having and ognl / loop related issue.
Here's the snippet that works on 4.0.2
<td jwcid="@For"
source="ognl:tab.searchCriteriaOptions"
value="ognl:currentFilterGroup"
index="ognl:currentFilterGroupIndex">
<div jwcid="@If"
element="literal:td"
condition="ognl:tab.searchCriteria[currentFilterGroupIndex] != null"
class="ognl:'filter' + getFilterColumnStyle(currentFilterGroupIndex)">
<select jwcid="@Select"
multiple="literal:false"
size="10"
onchange="ognl:'searchSubmit(\''+@
com.db.rdq.web.tapestry.html.component.Search@FILTER+'\', '+currentFilterGroupIndex+');'">
<div jwcid="@For"
source="ognl:currentFilterGroup"
value="ognl:currentFilter"
index="ognl:currentFilterIndex">
<option jwcid="@Option"
selected="ognl:tab.searchCriteriaSelections[currentFilterGroupIndex][currentFilterIndex]"
label="ognl:currentFilter">
</option>
</div>
</select>
</div>
</td>
But under 4.1.2 it's giving me the error:
2007-10-19 16:31:13,878, ERROR, [org.apache.tapestry.services.impl.HiveMindExpressionCompiler], line 179, Error generating OGNL getter for expression tab.searchCriteriaSelections[currentFilterGroupIndex][currentFilterIndex] with root $
Search_91@dc4a91e5[Home/$Search] and body:
{ return ($w) (((java.util.List)(($Search_91)$2).getTab().getSearchCriteriaSelections()).get((($Search_91)$2).getCurrentFilterGroupIndex())).get(((java.util.List)(($Search_91)$2).getCurrentFilterIndex()));}
org.apache.hivemind.ApplicationRuntimeException: Unable to add method java.lang.Object get(ognl.OgnlContext, java.lang.Object) to class $ASTChain_115b9f4b263: [source error] get(java.util.List) not found in java.lang.Object
at org.apache.tapestry.enhance.ClassFabImpl.addMethod(ClassFabImpl.java:278)
...
Caused by: javassist.CannotCompileException: [source error] get(java.util.List) not found in java.lang.Object
at javassist.CtBehavior.setBody(CtBehavior.java:347)
at javassist.CtBehavior.setBody(CtBehavior.java:316)
at org.apache.tapestry.enhance.ClassFabImpl.addMethod(ClassFabImpl.java:272)
... 161 more
Caused by: compile error: get(java.util.List) not found in java.lang.Object
...
Should we be using different ognl syntax for the new version of Tapestry?
I've tried updating the problem line to
selected="ognl:getTab().getSearchCriteriaSelections().get(currentFilterGroupIndex).get(currentFilterIndex)"
which works when the page serves but does not write the values back to the page:
2007-10-19 17:01:08,272, ERROR, [com.db.rdq.web.tapestry.html.RDQException], line 22, org.apache.tapestry.BindingException
2007-10-19 17:01:08,272, ERROR, [com.db.rdq.web.tapestry.html.RDQException], line 23, Unable to update OGNL expression '<parsed OGNL expression>' of $
Search_161@dc4a91e5[Home/$Search] to true: Inappropriate OGNL expression: get(currentFilterIndex)
2007-10-19 17:01:08,272, ERROR, [com.db.rdq.web.tapestry.html.RDQException], line 32,
2007-10-19 17:01:08,272, ERROR, [com.db.rdq.web.tapestry.html.RDQException], line 44,
binding|ExpressionBinding[Home/$Search getTab().getSearchCriteriaSelections().get(currentFilterGroupIndex).get(currentFilterIndex)]
location|context:/WEB-INF/Search.html, line 106
2007-10-19 17:01:08,272, ERROR, [com.db.rdq.web.tapestry.html.RDQException], line 22, org.apache.hivemind.ApplicationRuntimeException
2007-10-19 17:01:08,287, ERROR, [com.db.rdq.web.tapestry.html.RDQException], line 23, Unable to update OGNL expression '<parsed OGNL expression>' of $
Search_161@dc4a91e5[Home/$Search] to true: Inappropriate OGNL expression: get(currentFilterIndex)
2007-10-19 17:01:08,287, ERROR, [com.db.rdq.web.tapestry.html.RDQException], line 32,
2007-10-19 17:01:08,287, ERROR, [com.db.rdq.web.tapestry.html.RDQException], line 44,
component|$
Search_161@dc4a91e5[Home/$Search]
location|context:/WEB-INF/Home.html, line 51
2007-10-19 17:01:08,287, ERROR, [com.db.rdq.web.tapestry.html.RDQException], line 22, ognl.InappropriateExpressionException