JSP-09-use EL to display data, jsp-09-el data
Objective: To make JSP writing easier. 9.1 EL expression
$ {EL expression }:: {unsername}
Operator: "." OPERATOR: attribute used to access objects $ {news. title}
"[]" OPERATOR: attribute used to access objects $ {news ["title"]}
Used to access arrays or collections $ {newslist [0]}
Note: 1. EL is case sensitive.
2. Before using EL, you must first store the object in the scope. Storing an object in the scope does not copy the object. The scope only saves the reference of the object, so it has almost no impact on the server performance.
9.2 EL usage
Obtain attributes of a javaBean object |
$ {News. title} |
Obtains elements of an array, List, or Map object. |
$ {List [0]} |
Simple processing of raw data using various operators |
$ {TotalRecordCount/pageSize} can be computed. |
Block Common exceptions |
$ {Username} the username does not exist and no exception occurs. |
Easy Automatic type conversion |
$ {News} is equivalent to (News) request. getAttribute ("news ") |
9.3 jsp el-defined implicit objects
PageContext |
Provide access to page properties |
|
Request |
Accept the JSP page request from the client |
$ {PageContext. request. contextPath} |
Param |
The value of a single string should be set for the return request parameter name |
|
ParamValues |
Returns the Request Parameters mapped to the client. |
|
ParamScope |
Return the variable name of the page range. |
|
RequestScope |
|
|
SessionScope |
|
|
Applicationscope |
|
|
7.4 applicable Operators
1.5 EL access scope