You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Ezra Epstein (JIRA)" <de...@velocity.apache.org> on 2008/12/01 06:34:44 UTC

[jira] Commented: (VELTOOLS-110) An OGNL Tool, perhaps

    [ https://issues.apache.org/jira/browse/VELTOOLS-110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651906#action_12651906 ] 

Ezra Epstein commented on VELTOOLS-110:
---------------------------------------

OGNL wouldn't do any of the template combination, and parsing.  But it does do object-graph navigation, which, of course, Velocity does to some extent.  But OGNL opens up a world of goodies.  You can access ANY class loaded in the JVM and its static methods and fields, no need to configure a ClassTool per class.  OGNL can do projection across collections, it supports the ternary operator, built-in, also supports math and other operators - no need to use the #set directive, nor the MathTool.  So you can combine everything in one very naturally: that is, the syntax reads like Java syntax, including access to array elements by index.  In short it combines the features of quite a few tools with a few of the features of Velocity.  

http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/index.html 

to your point about the overlap, I think the two are mutually supportive frameworks.  Yes, one could, I suppose, write a version of Velocity that directly leverages OGNL internally, but that would still mean all the template parsing, etc. would be needed on top of OGNL.  The only caveat I've heard about OGNL is that some other approaches run faster.  But then if it's a tool, it's the template author's choice to use it or not.  One project that uses OGNL extensively is Tapestry.  See the 4.x version.  

> An OGNL Tool, perhaps
> ---------------------
>
>                 Key: VELTOOLS-110
>                 URL: https://issues.apache.org/jira/browse/VELTOOLS-110
>             Project: Velocity Tools
>          Issue Type: Improvement
>          Components: GenericTools
>    Affects Versions: 2.0
>            Reporter: Ezra Epstein
>            Priority: Minor
>
> I've been using a combination of the Velocity Tools and it occurred to me that much of the functionality is available via OGNL and so I was thinking about writing an OGNL tool.  Then it occurred to me that, perhaps, the V-Tools team hadn't yet checked out OGNL, so I'm dropping this note to mention it.  Do check it out.  OGNL with the V Context as the root "this" node, would be a very powerful tool.
> While on the subject of integrating with other things, I always wondered why the VelocityContext doesn't implement the java.util.Map interface.  I know that's part of the Velocity project not tools, but it's a curiosity for me.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org