Sylvain Wallez wrote:
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:
This is not true. You can call static methods and even constructors. Both from JXPath and JEXL.

  <jx:set var="buffer" value="${java.lang.StringBuffer('Hello ')}"/>
  <jx:set var="ignore" value="${buffer.append( 'World!' )}"/>
        <hw>${buffer.toString()}</hw>

Works like a charm in trunk.




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

Sylvain



--
Leszek Gawron                                      [EMAIL PROTECTED]
IT Manager                                         MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65