EL expression points to Remember

EL expressions are always within curly braces,and prefixed with a dollar($) sign ${expression} .

The first named variable in the expression is either an implicit object or an attribute in one of
the four scopes (page, request, session, or application).

The dot operator lets you access values by using a Map key or a bean property name, for example ${foo.bar} gives you the value of bar, where bar is the name of Map key into the Map foo, or bar is the property of bean foo. Whatever comes to the right of the dot operator must follow normal Java naming rules for identifiers! (In other words, must start with a letter, underscore, or dollar sign, can include numbers after the first charac- ter, but nothing else, etc.)

You can NEVER put anything to the right of the dot that wouldn’t be legal as a Java identifier. For example, you can’t say ${foo.1}. 

The [ ] operator is more powerful than the dot, because it lets you access arrays and Lists, and you can put other expressions including named variables within the brackets, and you can nest them to any level you can stand. 

For example, if musicList is an ArrayList, you can access the first value in the list by saying
${musicList[0]} OR ${musicList[“0”]}. EL doesn’t care if you put quotes around the list index

If what’s inside the brackets is not in quotes, the Container evaluates it. If it is in quotes, and it’s not an index into an array or List, the Container sees it as the literal name of a property or key.

All but one of the EL implicit objects are Maps. From the Map implicit objects you can get
attributes from any of the four scopes, request parameter values, header values, cookie values, and context init parameters. The non-map implicit object is pageContext, which is a reference to... the PageContext object.


Don’t confuse the implicit EL scope objects (Maps of the attributes) with the objects to which
the attributes are bound. In other words, don’t confuse the requestScope implicit object with
the actual JSP implicit request object. The only way to access the request object is by going through the pageContext implicit object. (Although some of what you might want from the
request is already available through other EL implicit objects, including param/paramValues,
header/headerValues, and cookie.)

EL functions allow you to call a public static method in a plain old Java class. The function
name does not have to match the actual method name! For example, ${foo:rollIt()} does not mean that there must be a method named rollIt() in a class that has a function.

The function name (e.g. rollIt()) is mapped to a real static method using a TLD (Tag Library
Descriptor) file. Declare a function using the <function> element, including the <name> of
the function (rollIt()), the fully-qualified <function-class>, and the <function-signature> which
includes the return type as well as the method name and argument list.

To use a function in a JSP, you must declare the namespace using a taglib directive. Put a prefix attribute in the taglib directive to tell the Container the TLD in which the function you’re calling can be found. Example: <%@ taglib prefix=”mine” uri=”/WEB-INF/foo.tld”%>