JSP - EL expression

A, EL expressions 11 built-in objects :

  Wherein // is the type Map 10; pageContext object is the last one;

pageScope

requestScope

sessionScope

applicationScope

param

paramValues

header

headerValues

Initfrm

cookie

pageContext

 

Second, the domain related objects:

  (1pageScope:${pageScope.name}等同与pageContext.getAttribute(“name”);

  (2requestScope:${requestScope.name}等同与request.getAttribute(“name”);

  (3sessionScoep: ${sessionScope.name}等同与session.getAttribute(“name”);

  (4applicationScope:${applicationScope.name}等同与application.getAttribute(“name”);

Third, the global find: $ { name };

  In turn represents pageScope, requesScopet, sessionScope, appliationScope find four domain names for the name of the property;

  $ {Name.value} // if the object is acquired, the attribute can be directly getting a property value point within the object, but only if there get method;

    // get the array: $ {name [ I ] .Value};

Fourth, the operator:

  1. arithmetic: + - * /%

  2. Relationship operations:> <!> = <= = ==

  3. logic operations: && ||!

  4. Analyzing:

  (1) Analyzing the empty: $ {empty   List } ; // List is empty;

  (2) determining non-empty: $ {Not empty   List } ; // if List is not empty;

    // Example: $ {80> 90}; $ {80 + 90};

V. element attributes related objects:

  ( . 1 ) $ { . Param name }: the same request.getParameter (String name) method;

  ( 2 ) $ { paramValues. Name }: the request. Same getParameterValues (String name) method;

    // using EL -time expressions acquisition parameters, if not obtain return an empty string, not null ;

Sixth, the request header related objects:

  (. 1) {$} header.Host : acquiring request header; the Map <String, String> type;

  (2) {$} headerValues.Host : multi-value acquisition request header; the Map <String, String []> type;

Seven objects related initialization parameters: the web.xml file <context-param> parameters;

  (1) $ {initParam.name}: Get the name name of parameter values;

  (2) $ {initParam [ 'name']}: single quotation marks in the table acquired, different wording;

    // If the parameter name contains _ underscore, must be used (2) under standard methods, other times random;

Eight, Cookie parameters:

  // return to Map <String, Cookie> type, where key is the name of Cookie, Cookie and the value is the object itself.

  (1) $ {cookie.name.name}: get the name of the cookie named name; // so stupid;

  (2) $ {cookie.name.value}: obtain the value of the cookie named name;

Nine, pageContext objects:

  Used to obtain additional eight jsp objects;

  // return type PageContext; may be used getXXX () methods:

  

Guess you like

Origin www.cnblogs.com/Tractors/p/11279060.html