cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist <mlundqui...@comcast.net>
Subject Re: Hashtables in JXTemplates
Date Tue, 28 Jun 2005 08:56:56 GMT
On 2005-06-27 11:08:14 -0700, Brent Johnson <bljohnson@gmail.com> said:

> I'm having a serious problem trying to use a Hashtable-like datatype
> in a JXTemplate.  First I tried populating a java.util.Hashtable in
> flowscript, then passed that to the JXTemplate.  But apparently I cant
> loop through an Enumeration using a jx:forEach.

But you can iterate over a Collection :-)  Is there a reason you can't 
use HashMap instead of Hashtable?  If you can, then it should work just 
fine!

>   When I try I just get
> a single iteration of type:
> 
> org.apache.cocoon.generation.JXTemplateGenerator$JXTExpression@fe9ad1
> 
> I also have a Hashtable implementation in Javascript.  I include my
> hashtable.js in my sitemap, populate it in my flowscript, this pass
> this on to the JXTemplate.  When I try to access the size() function
> for the JS object in my JXT I get the following:
> 
> size() : unknown type : class org.mozilla.javascript.NativeObject
> 
> But I can access the size() function in the flowscript just fine, just
> doesn't seem to work in the JXTemplate when I try with something like
> ${menuitems.size()}.

IIRC, this is because size() is a JEXL built-in, so that's what you're 
gettting instead of your Hashtable'size() or whatever.

HTH,
—ml—



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message