EL overview of jsp
##EL expression overview
What is an EL expression?
EL (Express Lanuage) expressions can be embedded inside jsp pagesWhat is the meaning of EL expressions? It
is to replace the writing of output scripts in jsp pages and reduce the writing of jsp scriptsHow to write EL expression?
${EL表达式内容}
- The role of EL expression:
- Find the specified data from the domain object.
- Built-in object usage
- Execution operator
jsp page code:
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
<title>$Title$</title>
</head>
<body>
<h1>我是jsp</h1>
<!-- 方式1: 编译后代码存放在Service方法中 -->
<%
int a = 10;
System.out.println(a);
%>
<!-- (3)方式2:这里的代码会被编译到成员位置 -->
<%!
String username;
public void myMethod(){
System.out.println("myMethod");
}
%>
<!-- (4)方式3:页面输出内容 -->
<%= "你想打印啥"%>
</body>
</html>
running result: