重生day04

javaBean,el表达式

javaBean说到底是一个类,

1、使用public修饰

2、公共的无参构造方法

3、包含属性的操作方法


el表达式,原理是pageContext里有个方法findAttribute()

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>




Insert title here


<%
	//pageContext.setAttribute("msg","pageContextValue");
	request.setAttribute("msg","requestValue");
	session.setAttribute("msg","sessionValue");
	application.setAttribute("msg","applicationValue");
%>
${msg}

el的内置对象或者叫隐式对象

重生day04_第1张图片

使用eltest?username=xiao来访问就可以看到值

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>




Insert title here


username=${param.username}	



el内置对象的作用域,主要是用来获取不同作用域的值

重生day04_第2张图片

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>




Insert title here


<%
	pageContext.setAttribute("msg","pageContextValue");
	request.setAttribute("msg","requestValue");
	session.setAttribute("msg","sessionValue");
	application.setAttribute("msg","applicationValue");
%>
pageContext=${pageScope.msg}
request=${requestScope.msg}
session=${sessionScope.msg}
application=${applicationScope.msg}


你可能感兴趣的:(重生day04)