The purpose of EL is to aid producing scriptless JSP pages
Syntax of EL in a JSP page :$ {expr}
You can escape the expression:
\ $ {Expr}
<Body>
<Form action = "el2.jsp">
Username: <input type = "text" name = "username">
Password: <input type = "submit" name = "password">
<Input type = "submit" value = "submit">
</Form>
<Body>
$ {Param. username}
$ {Param. password}
<! -- <% = Request. getParameter ("username") %> -->
</Body>
Beans within the namespace avaiable to the JSP can be accessed easily using EL.
Beans can be accessed by way of dot notation: $ {bean. attribute}
Beans can be located by searching through the scopes: page, request, session and application
Beans scope can be specified by preceding the bean name with the scope
$ {SessionScope. cust. fristName}
<% Session. setAttribute ("aa", "bb"); %>
$ {SessionScope. aa} <br>
<% = Session. getAttribute ("aa") %>
Implicit Object: Description
If the bean return an array, and element can specify its
Index using [] nation:
$ {ParamValues. fruit [2]}
Username: <input type = "text" name = "username">
<Input type = "text" name = "username">
<Input type = "text" name = "username">
$ {ParamValue. username [2]}
Example operation
${2 + 1*3}
User user = new User;
Session. setAttribute ("user", user );
$ {SessionScope. user. sex}
User user = (User) session. getAttribute ("user ");
String sex = user. getSex ();
$ {SessionScope. user. sex} equals $ {sessionScope. user ["sex"]}
TypeCast: $ {param. count + 20}