cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ellis Pritchard <el...@nukinetics.com>
Subject Re: JXTG: from flow vs directly from sitemap
Date Fri, 18 Feb 2005 13:28:21 GMT
Leszek Gawron wrote:

> Daniel and I have found out some strange behaviour concerning JEXL in 
> Jxtg. Users started reporting this also:
>
> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=110867204019252&w=2
>
> The only thing we know is that the problems occur when the pipeline is 
> not invoked from flowscript.
>
> <root xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
>
>   <test1>
>     <jx:set var="var1" value="foo"/>
>     <jx:out value="${var1}"/>
>   </test1>
>
>   <test2>
>     <jx:set var="map" value="${java.util.HashMap()}"/>
>     <jx:set var="ignored" value="${map.put('foo', 'bar')}"/>
>     <jx:out value="${map.foo}"/>
>   </test2>
>
> </root>
>
> For what we know test2 does not work. "map" variable is not properly 
> initialized.
>
> Could anybody comment?

AFAICS (looking at the code) the 'java' Package object which you are 
implicitly using when you do the ${java.util.HashMap()} is only set up 
(and thus available to JXTemplate) if the FOM JavaScript interpreter is 
called first in the context of the request. Thus this facility is not 
set up generically for JXTemplates, only JXTemplates called from a flow.

This is why doing a 'null' flow which just calls your JX view works; the 
java package is set up by the flow; if the 'null' flow also contained 
other importPackage() function calls, you would also be able to use 
those packages in the JXTemplate.

Ellis.


Mime
View raw message