JSP-09-use EL to display data, jsp-09-el data

Source: Internet
Author: User

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

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.