CINXE.COM
OGNL - Apache Commons OGNL - Object Graph Navigation Library
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Generated by Apache Maven Doxia at Mar 1, 2013 ( $Revision: 1080083 $ ) --> <!-- $HeadURL: https://svn.apache.org/repos/asf/commons/proper/commons-skin/trunk/src/main/resources/META-INF/maven/site.vm $ --> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>OGNL - Apache Commons OGNL - Object Graph Navigation Library</title> <style type="text/css" media="all"> @import url("./css/maven-base.css"); @import url("./css/maven-theme.css"); @import url("./css/site.css"); </style> <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" /> <meta name="author" content="Apache Commons community (dev AT apache DOT org)" /> <meta name="Date-Revision-yyyymmdd" content="20130301" /> <meta http-equiv="Content-Language" content="en" /> <link rel="stylesheet" type="text/css" media="all" href="./css/prettify.css"/> <script src="./js/prettify.js" type="text/javascript"></script> <script type="text/javascript">window.onload=function() { prettyPrint(); }</script> </head> <body class="composite"> <div id="banner"> <div id="bannerLeft"> <a href="http://commons.apache.org/" title="Apache Commons logo"> <img src="./images/commons-logo.png" alt="Apache Commons logo"/> </a> </div><!-- id="bannerLeft" --> <div id="bannerRight"> <a href="index.html"> <img src="images/logo.png" alt="Commons OGNL"/> </a> </div><!-- id="bannerRight" --> <div class="clear"> <hr/> </div> </div> <div id="breadcrumbs"> <div class="xleft"> <span id="publishDate">Last Published: 01 March 2013</span> | <span id="projectVersion">Version: 4.0-SNAPSHOT</span> </div> <div class="xright"> <a href="http://www.apachecon.com/" class="externalLink" title="ApacheCon">ApacheCon</a> | <a href="http://www.apache.org" class="externalLink" title="Apache">Apache</a> | <a href="../" title="Commons">Commons</a> </div> <div class="clear"> <hr/> </div> </div> <div id="leftColumn"> <div id="navcolumn"> <h5>OGNL</h5> <ul> <li class="none"> <strong>Overview</strong> </li> <li class="none"> <a href="download_ognl.cgi" title="Download">Download</a> </li> <li class="none"> <a href="language-guide.html" title="Language Guide">Language Guide</a> </li> <li class="none"> <a href="developer-guide.html" title="Developer Guide">Developer Guide</a> </li> <li class="none"> <a href="benchmark.html" title="Benchmarks">Benchmarks</a> </li> </ul> <h5>Development</h5> <ul> <li class="none"> <a href="mail-lists.html" title="Mailing Lists">Mailing Lists</a> </li> <li class="none"> <a href="issue-tracking.html" title="Issue Tracking">Issue Tracking</a> </li> <li class="none"> <a href="source-repository.html" title="Source Repository">Source Repository</a> </li> <li class="none"> <a href="building.html" title="Building">Building</a> </li> <li class="none"> <a href="apidocs/index.html" title="Javadoc (SVN latest)">Javadoc (SVN latest)</a> </li> </ul> <h5>Project Documentation</h5> <ul> <li class="expanded"> <a href="project-info.html" title="Project Information">Project Information</a> <ul> <li class="none"> <strong>About</strong> </li> <li class="none"> <a href="project-summary.html" title="Project Summary">Project Summary</a> </li> <li class="none"> <a href="team-list.html" title="Project Team">Project Team</a> </li> <li class="none"> <a href="source-repository.html" title="Source Repository">Source Repository</a> </li> <li class="none"> <a href="issue-tracking.html" title="Issue Tracking">Issue Tracking</a> </li> <li class="none"> <a href="mail-lists.html" title="Mailing Lists">Mailing Lists</a> </li> <li class="none"> <a href="dependencies.html" title="Dependencies">Dependencies</a> </li> <li class="none"> <a href="integration.html" title="Continuous Integration">Continuous Integration</a> </li> <li class="none"> <a href="distribution-management.html" title="Distribution Management">Distribution Management</a> </li> </ul> </li> <li class="collapsed"> <a href="project-reports.html" title="Project Reports">Project Reports</a> </li> </ul> <h5>Commons</h5> <ul> <li class="none"> <a href="../" title="Home">Home</a> </li> <li class="none"> <a href="http://www.apache.org/licenses/" class="externalLink" title="License">License</a> </li> <li class="collapsed"> <a href="../components.html" title="Components">Components</a> </li> <li class="collapsed"> <a href="../sandbox/index.html" title="Sandbox">Sandbox</a> </li> <li class="collapsed"> <a href="../dormant/index.html" title="Dormant">Dormant</a> </li> </ul> <h5>General Information</h5> <ul> <li class="none"> <a href="../volunteering.html" title="Volunteering">Volunteering</a> </li> <li class="none"> <a href="../patches.html" title="Contributing Patches">Contributing Patches</a> </li> <li class="none"> <a href="../building.html" title="Building Components">Building Components</a> </li> <li class="none"> <a href="../releases/index.html" title="Releasing Components">Releasing Components</a> </li> <li class="none"> <a href="http://wiki.apache.org/commons/FrontPage" class="externalLink" title="Wiki">Wiki</a> </li> </ul> <h5>ASF</h5> <ul> <li class="none"> <a href="http://www.apache.org/foundation/how-it-works.html" class="externalLink" title="How the ASF works">How the ASF works</a> </li> <li class="none"> <a href="http://www.apache.org/foundation/getinvolved.html" class="externalLink" title="Get Involved">Get Involved</a> </li> <li class="none"> <a href="http://www.apache.org/dev/" class="externalLink" title="Developer Resources">Developer Resources</a> </li> <li class="none"> <a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship">Sponsorship</a> </li> <li class="none"> <a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks">Thanks</a> </li> </ul> <a href="http://www.apache.org/events/current-event.html" title="ApacheCon" class="poweredBy"> <img class="poweredBy" alt="ApacheCon" src="http://www.apache.org/events/current-event-125x125.png" /> </a> <a href="http://maven.apache.org/" title="Maven" class="poweredBy"> <img class="poweredBy" alt="Maven" src="http://maven.apache.org/images/logos/maven-feather.png" /> </a> </div> </div> <div id="bodyColumn"> <div id="contentBox"> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <div class="section"><h2>Apache Commons OGNL - Object Graph Navigation Library<a name="Apache_Commons_OGNL_-_Object_Graph_Navigation_Library"></a></h2> <p> OGNL stands for Object-Graph Navigation Language; it is an expression language for getting and setting properties of Java objects, plus other extras such as list projection and selection and lambda expressions. You use the same expression for both getting and setting the value of a property. </p> <p> The <tt>Ognl</tt> class contains convenience methods for evaluating OGNL expressions. You can do this in two stages, parsing an expression into an internal form and then using that internal form to either set or get the value of a property; or you can do it in a single stage, and get or set a property using the String form of the expression directly. </p> <p> OGNL started out as a way to set up associations between UI components and controllers using property names. As the desire for more complicated associations grew, Drew Davidson created what he called KVCL, for Key-Value Coding Language, egged on by Luke Blanshard. Luke then reimplemented the language using ANTLR, came up with the new name, and, egged on by Drew, filled it out to its current state. Later on Luke again reimplemented the language using JavaCC. Further maintenance on all the code is done by Drew (with spiritual guidance from Luke). </p> <p> We pronounce OGNL as a word, like the last syllables of a drunken pronunciation of "<i>orthogonal</i>". </p> </div> <div class="section"><h2>Introduction<a name="Introduction"></a></h2> <p> Many people have asked exactly what <tt>OGNL</tt> is good for. Several of the uses to which <tt>OGNL</tt> has been applied are: </p> <ul> <li> A binding language between GUI elements (textfield, combobox, etc.) to model objects. Transformations are made easier by <tt>OGNL</tt>'s TypeConverter mechanism to convert values from one type to another (String to numeric types, for example); </li> <li> A data source language to map between table columns and a Swing TableModel; </li> <li> A binding language between web components and the underlying model objects; </li> <li> A more expressive replacement for the property-getting language used by the Apache Commons BeanUtils package or JSTL's EL (which only allow simple property navigation and rudimentary indexed properties). </li> </ul> <p> Most of what you can do in Java is possible in <tt>OGNL</tt>, plus other extras such as list <i>projection</i>, <i>selection</i> and <i>lambda expressions</i>. </p> </div> </div> </div> <div class="clear"> <hr/> </div> <div id="footer"> <div class="center">Copyright © 1997-2013 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved. </div> <div class="center">Apache Commons, Apache Apache Commons OGNL - Object Graph Navigation Library, Apache, the Apache feather logo, and the Apache Commons project logos are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.</div> <div class="clear"> <hr/> </div> </div> </body> </html>