Home  >  Article  >  Web Front-end  >  Can EL expressions be used in HTML5?

Can EL expressions be used in HTML5?

WBOY
WBOYOriginal
2022-06-01 15:45:412104browse

EL expressions cannot be used in HTML5; EL expressions are used to replace expression scripts in JSP pages for data output. Therefore, EL expressions are written in jsp pages, not in HTML5 pages. Expressions The expression is generally the key of the domain object, which can make JSP writing easier. The syntax of EL expression is "${expression}".

Can EL expressions be used in HTML5?

The operating environment of this article: Windows 10 system, html5 version, Dell G3 computer.

Can EL expressions be used in HTML5

EL expressions cannot be used in HTML5

The full name of EL expression: Expression Language, that is, expression Language

The role of EL expression: instead of the expression script in the JSP page for data output

EL expression is much simpler than the JSP expression script

EL expression The format is: ${expression},

EL (Expression Language) is to make JSP writing easier. Expression language is inspired by ECMAScript and XPath expression language. It provides methods to simplify expressions in JSP, making JSP code more simplified.

Note: EL expressions are written in the jsp page, and the expression is generally the key of the domain object

Code demonstration: Create Test.jsp## in the web directory #

<body>
    <%
        request.setAttribute("key", "value");        
    %>
    <%--  表达式脚本输出key1的值  --%>
    <%=request.getAttribute("key1")%>
    <%--  EL表达式输出key1的值  --%>
    ${key1}
    <%--  表达式脚本输出null值时页面显示null
          EL表达式输出null值时页面什么都不显示(空串)--%>
</body>

Run results:

Can EL expressions be used in HTML5?

Recommended tutorial: "

html video tutorial"

The above is the detailed content of Can EL expressions be used in HTML5?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn