Begin forwarded message:OGNL used to use ANTLR but moved away some time ago to use JavaCC. It allowed OGNL to be deployed as a standalone unit without having to carry around another jar file. Plus complaints were heard because some people used ANTLR for other parts of the project and the version that OGNL required was not compatible. So JavaCC is a Good Thing in this regard.
Well, I used ANTLR because I'm familiar with LALR(1) parsers, and I knew
I could make it work. Also, I don't think (from a quick look at the
documentation) that you can do the Foo[] syntax (which I use to drop in
the index count of the current indexed property) using OGNL. On the
other hand, I'm not at all wedded to ANTLR, if someone wants to take a
shot at implementing the grammer using another tool, that's great.
I'm willing to bet that just about anything you want to do with an expression language is doable with OGNL. It really gives you all the power of Java within the language plus lots of niceties for working with collections (projection and selection), provides "lambda expressions" for encapsulated functions that can be called within OGNL.
I'm not sure what the Foo[] syntax is but OGNL has powerful indexing facilities, both JavaBeans indexed properties (i.e. getFoo(int i)/setFoo(int i, Object o)) and "object indexed properties", which is new to 2.6.0. Object indexed properties allow you do access things that look like indexed properties (getAttribute(String name)/setAttribute(String name, Object value)) as indexed properties (i.e. request.attributes["foo"]) without having to call a method. Is any of this what he means?
Well...as far as the && syntax goes XML is not forgiving unless you use CDATA segments. For expressions that are part of attribute values you don't have any way around it.On a side note, one of the things I'm unhappy with is that I have to use
AND and OR rather than && and ||, because when I used &&, it blows up
the XML parsing of validation.xml. Is there a way to get around this?
So instead of :
<expression>this && that</expression>
you have:
<expression><![CDATA[ this && that ]]></expression>
or:
<expression>
<![CDATA[
this && that
]]>
</expression>It's up to you to decide which is more readable. _I_ think it's gobbledygook any way you slice it.
The issue here is really only the &, && and < operators because it interferes with the XML reserved characters. Everything else works fine. It's a real bummer.
- Drew
-- +---------------------------------+ < Drew Davidson | OGNL Technology > < Professional Open Source > +---------------------------------+ | Email: [EMAIL PROTECTED] / | Web: http://www.ognl.org / | Vox: (520) 531-1966 < | Fax: (520) 531-1965 \ | Mobile: (520) 405-2967 \ +---------------------------------+
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
