javax.el

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » JUEL » javax.el 
javax.el
Provides the API for the Unified Expression Language shared by the JSP 2.1 and JSF 1.2 technologies.

The Expression Language (EL) is a simple language designed to satisfy the specific needs of web application developers. It is currently defined in its own specification document within the JavaServer Pages (tm) (JSP) 2.1 specification, but does not have any dependencies on any portion of the JSP 2.1 specification. It is intended for general use outside of the JSP and JSF specifications as well.

This package contains the classes and interfaces that describe and define the programmatic access to the Expression Language engine. The API is logically partitioned as follows:

EL Context

An important goal of the EL is to ensure it can be used in a variety of environments. It must therefore provide enough flexibility to adapt to the specific requirements of the environment where it is being used.

Class {@link javax.el.ELContext} is what links the EL with the specific environment where it is being used. It provides the mechanism through which all relevant context for creating or evaluating an expression is specified.

Creation of ELContext objects is controlled through the underlying technology. For example, in JSP, the JspContext.getELContext() factory method is used.

Some technologies provide the ability to add an {@link javax.el.ELContextListener} so that applications and frameworks can ensure their own context objects are attached to any newly created ELContext.

Expression Objects

At the core of the Expression Language is the notion of an expression that gets parsed according to the grammar defined by the Expression Language.

There are two types of expressions defined by the EL: value expressions and method expressions. A {@link javax.el.ValueExpression} such as "${customer.name}" can be used either as an rvalue (return the value associated with property name of the model object customer) or as an lvalue (set the value of the property name of the model object customer).

A {@link javax.el.MethodExpression} such as "${handler.process}" makes it possible to invoke a method (process) on a specific model object (handler).

All expression classes extend the base class {@link javax.el.Expression}, making them serializable and forcing them to implement equals() and hashCode(). Morevover, each method on these expression classes that actually evaluates an expression receives a parameter of class {@link javax.el.ELContext}, which provides the context required to evaluate the expression.

Creation of Expressions

An expression is created through the {@link javax.el.ExpressionFactory} class. The factory provides two creation methods; one for each type of expression supported by the EL.

To create an expression, one must provide an {@link javax.el.ELContext}, a string representing the expression, and the expected type (ValueExpression) or signature (MethodExpression). The ELContext provides the context necessary to parse an expression. Specifically, if the expression uses an EL function (for example ${fn:toUpperCase(customer.name)}) or an EL variable, then {@link javax.el.FunctionMapper} and {@link javax.el.VariableMapper} objects must be available within the ELContext so that EL functions and EL variables are properly mapped.

Resolution of Model Objects and their Properties

Through the {@link javax.el.ELResolver} base class, the EL features a pluggable mechanism to resolve model object references as well as properties of these objects.

The EL API provides implementations of ELResolver supporting property resolution for common data types which include arrays ({@link javax.el.ArrayELResolver}), JavaBeans ({@link javax.el.BeanELResolver}), Lists ({@link javax.el.ListELResolver}), Maps ({@link javax.el.MapELResolver}), and ResourceBundles ({@link javax.el.ResourceBundleELResolver}).

Tools can easily obtain more information about resolvable model objects and their resolvable properties by calling method getFeatureDescriptors on the ELResolver. This method exposes objects of type java.beans.FeatureDescriptor, providing all information of interest on top-level model objects as well as their properties.

EL Functions

If an EL expression uses a function (for example ${fn:toUpperCase(customer.name)}), then a {@link javax.el.FunctionMapper} object must also be specified within the ELContext. The FunctionMapper is responsible to map ${prefix:name()} style functions to static methods that can execute the specified functions.

EL Variables

Just like {@link javax.el.FunctionMapper} provides a flexible mechanism to add functions to the EL, {@link javax.el.VariableMapper} provides a flexible mechanism to support the notion of EL variables.

An EL variable does not directly refer to a model object that can then be resolved by an ELResolver. Instead, it refers to an EL expression. The evaluation of that EL expression gives the EL variable its value.

For example, in the following code snippet

<h:inputText value="#{handler.customer.name}"/>
handler refers to a model object that can be resolved by an EL Resolver.

However, in this other example:

<c:forEach var="item" items="#{model.list}">
   <h:inputText value="#{item.name}"/>
</c:forEach>
item is an EL variable because it does not refer directly to a model object. Instead, it refers to another EL expression, namely a specific item in the collection referred to by the EL expression #{model.list}.

Assuming that there are three elements in ${model.list}, this means that for each invocation of <h:inputText>, the following information about item must be preserved in the {@link javax.el.VariableMapper}:

first invocation: item maps to first element in ${model.list}
second invocation: item maps to second element in ${model.list}
third invocation: item maps to third element in ${model.list}

VariableMapper provides the mechanisms required to allow the mapping of an EL variable to the EL expression from which it gets its value.

Java Source File NameTypeComment
ArrayELResolver.javaClass Defines property resolution behavior on arrays.

This resolver handles base objects that are Java language arrays. It accepts any object as a property and coerces that object into an integer index into the array.

BeanELResolver.javaClass Defines property resolution behavior on objects using the JavaBeans component architecture.

This resolver handles base objects of any type, as long as the base is not null.

CompositeELResolver.javaClass Maintains an ordered composite list of child ELResolvers.

Though only a single ELResolver is associated with an ELContext, there are usually multiple resolvers considered for any given variable or property resolution.

ELContext.javaClass Context information for expression evaluation.

To evaluate an Expression , an ELContext must be provided.

ELContextEvent.javaClass An event which indicates that an ELContext has been created.
ELContextListener.javaInterface The listener interface for receiving notification when an ELContext is created.
ELException.javaClass Represents any of the exception conditions that can arise during expression evaluation.
ELResolver.javaClass Enables customization of variable and property resolution behavior for EL expression evaluation.

While evaluating an expression, the ELResolver associated with the ELContext is consulted to do the initial resolution of the first variable of an expression.

ELUtil.javaClass

Utility methods for this portion of the EL implementation

Methods on this class use a Map instance stored in ThreadLocal storage to minimize the performance impact on operations that take place multiple times on a single Thread.

Expression.javaClass Base class for the expression subclasses ValueExpression and MethodExpression , implementing characterstics common to both.

All expressions must implement the equals() and hashCode() methods so that two expressions can be compared for equality.

ExpressionFactory.javaClass
FactoryFinder.javaClass
FunctionMapper.javaClass The interface to a map between EL function names and methods.
ListELResolver.javaClass Defines property resolution behavior on instances of java.util.List .

This resolver handles base objects of type java.util.List. It accepts any object as a property and coerces that object into an integer index into the list.

MapELResolver.javaClass Defines property resolution behavior on instances of java.util.Map .

This resolver handles base objects of type java.util.Map. It accepts any object as a property and uses that object as a key in the map.

MethodExpression.javaClass An Expression that refers to a method on an object.

The ExpressionFactory.createMethodExpression method can be used to parse an expression string and return a concrete instance of MethodExpression that encapsulates the parsed expression. The FunctionMapper is used at parse time, not evaluation time, so one is not needed to evaluate an expression using this class.

MethodInfo.javaClass Holds information about a method that a MethodExpression evaluated to.
MethodNotFoundException.javaClass Thrown when a method could not be found while evaluating a MethodExpression .
PropertyNotFoundException.javaClass Thrown when a property could not be found while evaluating a ValueExpression or MethodExpression .
PropertyNotWritableException.javaClass Thrown when a property could not be written to while setting the value on a ValueExpression .
ResourceBundleELResolver.javaClass Defines property resolution behavior on instances of java.util.ResourceBundle .

This resolver handles base objects of type java.util.ResourceBundle.

ValueExpression.javaClass An Expression that can get or set a value.

In previous incarnations of this API, expressions could only be read.

VariableMapper.javaClass The interface to a map between EL variables and the EL expressions they are associated with.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.