cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonas Ekstedt <>
Subject Converting expression evaluator
Date Mon, 08 Nov 2004 04:35:59 GMT

I have created a small expression evaluator based on commons-el and
wondered if you would be interested in it. It is not finished but the
basic functionality is there.

The major feature of it is that it supports object conversion similar to
what Daniel Fagerström proposed some time ago:

Objects retrieved will be converted to the requested object type. One
can also supply a special type attribute that differentiates between
converters of similar sort. For example with a configuration file like
<?xml version="1.0"?>
  <converter from="java.util.Date" to="java.lang.String"

  <converter from="java.util.Date" to="java.lang.String" type="full"

You can execute expressions like (if I have a date variable containing a
Date, and locale=sv):

${date} -> "2004-nov-08"
${date#full} -> "den 8 november 2004"

If you want to try it out it can be found at

Installation instructions:
* Unzip
* apply TagTransformer.patch in $COCOON_HOME
* cd el
* ant build.webapp
* ant test
* ant deploy
* point your servlet container to /path/to/el/webapp

To make it usable in a webapp I created an extended version of the
TagTransformer to support the expression evaluator. Currently
expressions can only be used in text nodes as I haven't gotten around to
doing it for attributes.

Cheers Jonas

View raw message