cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: Java objects in JX templates
Date Mon, 30 Jan 2006 13:57:00 GMT
Ugo Cei wrote:
> Our docs [1] state that something like:
>
>  <jx:forEach var="${var}"
>          items="${java.util.StringTokenizer(items, delims)}">
>   </jx:forEach>
>
> should work. However, that doesn't seem to be the case, at least in 
> 2.1.8 while it apparently worked before. I did a few more tests and 
> discovered that even simple cases like ${java.util.Date()} produce no 
> output and no error message. This even if I put "Packages." in front 
> of the package name. Is this a bug or what?

You can only call methods on existing objects. I had to use a static 
method (only callable using JXPath!) as a workaround in the CForms macros:

<jx:set var="cformsHelper" 
value="#{org.apache.cocoon.forms.generation.JXMacrosHelper.createHelper($cocoon/consumer,$cocoon/request,$cocoon/parameters/locale)}"/>

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://bluxte.net                     http://www.anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


Mime
View raw message