Hello JSP!
Now, using an expression in the body of the tag, like this: Box Perimeter is: ${2*box.width + 2*box.height} Parentheses can be used in EL expressions to group sub-expressions. For example, ${(1 + 2) * 3} equals 9, but ${1 + (2 * 3)} equals 7. To disable the evaluation of EL expressions, you need to set the isELIgnored attribute value to true using the page directive: This way, EL expressions will be ignored. If set to false, the container will evaluate the EL expressions. * * * ## Basic Operators in EL EL expressions support most of the arithmetic and logical operators provided by Java: | **Operator** | **Description** | | --- | --- | | . | Access a Bean property or a map entry | | [] | Access an array or list element | | ( ) | Group a sub-expression to change precedence | | + | Addition | | - | Subtraction or negation | | * | Multiplication | | / or div | Division | | % or mod | Modulus | | == or eq | Test for equality | | != or ne | Test for inequality | | or gt | Test for greater than | | = or ge | Test for greater than or equal to | | && or and | Test for logical AND | | || or or | Test for logical OR | | ! or not | Test for logical NOT | | empty | Test for empty value | * * * ## Functions in JSP EL JSP EL allows you to use functions in expressions. These functions must be defined in a custom tag library. The syntax for using a function is as follows: ${ns:func(param1, param2, ...)} ns refers to the namespace, func refers to the function name, param1 refers to the first parameter, param2 refers to the second parameter, and so on. For example, there is a function fn:length defined in the JSTL library, which can be used to get the length of a string like this: ${fn:length("Get my length")} To use functions from any tag library, you need to install these libraries on the server and then include them in the JSP file using the tag. * * * ## JSP EL Implicit Objects JSP EL supports the implicit objects listed in the following table: | **Implicit Object** | **Description** | | --- | --- | | pageScope | Page scope | | requestScope | Request scope | | sessionScope | Session scope | | applicationScope | Application scope | | param | Request object's parameter, String | | paramValues | Request object's parameter, String array | | header | HTTP header, String | | headerValues | HTTP header, String array | | initParam | Context initialization parameter | | cookie | Cookie value | | pageContext | The pageContext object of the current page | You can use these objects in expressions just like variables. A few examples will be given next to better understand this concept. * * * ## The pageContext Object The pageContext object is a reference to the pageContext object in JSP. Through the pageContext object, you can access the request object. For example, to access the query string passed in the request object, like this: ${pageContext.request.queryString} * * * ## Scope Objects The pageScope, requestScope, sessionScope, and applicationScope variables are used to access variables stored at various scope levels. For example, if you need to explicitly access the box variable at the applicationScope level, you can do so like this: applicationScope.box. * * * ## param and paramValues Objects The param and paramValues objects are used to access parameter values, using the request.getParameter method and the request.getParameterValues method. For example, to access a parameter named order, you can use the expression: ${param.order}, or ${param}. The following example demonstrates how to access the username parameter in the request:${param}
${header}
YouTip