线程 网络编程 集合框架 servlet 生命周期
回顾
EL 表达式
注意
jstl 分类
<%@page import="org.lq.entity.Users"%>
<%@page import="java.util.Map"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
request.setAttribute("num", 5);
int num1 = 7;
pageContext.setAttribute("num1", "7");
List list=new ArrayList();
list.add("admin1");
list.add("admin2");
list.add("admin3");
list.add("admin4");
request.setAttribute("list", list);
String []strs = {"das","fsd","sml"};
request.setAttribute("strs", strs);
Map map = new HashMap();
map.put("id", 1001);
map.put("name", "李四");
request.setAttribute("map", map);
%>
<h1>
变量:${num+5 }
</h1>
<h1>pagecontext: ${pageScope.num1 }</h1>
<h1>数组:${Arrays.toString(strs) }</h1>
<h1>map: ${map }</h1>
<%=request.getAttribute("list") %>
<%
Users u = new Users();
u.setId(1001);
u.setName("无语");
u.setAge(16);
request.setAttribute("user", u);
Users u1 = new Users();
request.setAttribute("u1", u1);
%>
<h1>${user.id }====${user.name }======${user.age }</h1>
${empty user }
<hr>
${user.name == '无语'}
${user.name eq '无语' }
${user eq u1 }
${user == u1 }
${user != null ? '存在' : '不存在' }
</body>
</html>
难过时记得微笑 11:42:50
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
request.setAttribute("name", "张三");
%>
<c:out value="你好===jstl"></c:out><br>
${name }<br>
<c:out value="${name }"></c:out><br>
<c:out value="${name1 }" default="你没有值"></c:out>
<hr>
<c:set var="setName" value="set赋值"></c:set>
<c:out value="${setName }"></c:out>
<hr>
<c:remove var="setName"/>
<c:out value="${setName }" default="你已经删除了"></c:out>
<hr>
<c:catch var="errorInfo">
<c:set property="aaa" target="user"></c:set>
</c:catch>
<c:out value="${erroInfo }"></c:out>
</body>
</html>
难过时记得微笑 12:03:10
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Map"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<c:if test="${1==2 }" var="result">
这是真的
</c:if>
<c:if test="${!result }">
这是假的
</c:if>
<hr>
<c:set value="9" var="grade"></c:set>
<c:choose>
<c:when test="${grade>90 }">
<h1>成绩优秀</h1>
</c:when>
<c:when test="${grade>75 }">
<h1>成绩良好</h1>
</c:when>
<c:when test="${grade>60 }">
<h1>成绩及格</h1>
</c:when>
<c:otherwise>
<h1>没有通过考试!!!</h1>
</c:otherwise>
</c:choose>
<hr>
<%
List list = new ArrayList();
list.add("admin0");
list.add("admin1");
list.add("admin2");
list.add("admin3");
list.add("admin4");
request.setAttribute("list", list);
Map map = new HashMap();
map.put("1001", "张三");
map.put("1002", "李四");
map.put("1003", "王五");
map.put("1004", "赵六");
request.setAttribute("map", map);
%>
<c:forEach items="${list }" var="e" begin="0" end="30" step="1" varStatus="status">
${e }====${status.index }====${status.count }====${status.first }====${status.last }<br>
</c:forEach>
<hr>
<c:forEach items="${map }" var="m">
${m }====key:${m.key }====value:${m.value }<br>
</c:forEach>
<hr>
<c:forTokens items="a,b,c,d" delims="," var="s">
截取后:${s }<br>
</c:forTokens>
<hr>
</body>
</html>
数据库连接池
Druid : ali
DBCP: apche
c3p0: 4年没更新
需要jar包
使用dbcp 需要 依赖 两个包
JNDI
总结