jsp the EL expression $ {}

 

Original location: https: //zhidao.baidu.com/question/711232806155434565.html

jsp tag expression $ {} is calculated for output, or the content of an expression, such as $ 5 + {3}, then the output will be on page 8, in the example $ {sessionScope.username}, it will obtain Session value inside the username, i.e. it can not be used in <%> code blocks in.

Role: EL (Expression Language) in order to make it easier to write JSP. Inspiration comes from the expression language ECMAScript and the XPath expression language that provides a simplified method in JSP expressions, let Jsp code more streamlined.

Extended Information

jsp in $ {} is a conventional representation EL expressions

The purpose is to get the value in {} specified object (parameters, objects, etc.)

Such as:

${user.name}<====>User user = (User)request(搜寻范围).getAttribute(user);

String name = user.getName();

out.println(name);

Began to search for user objects from the current page, and then change the object's name to obtain the property value

The scope of the search followed by: page, request, session, application

If it does not search that returns a null value that is often used in programming jsp + servlet, if the EL expression is just learning, the proposed master.

Guess you like

Origin www.cnblogs.com/isme-zjh/p/11995878.html