<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.tinysoft.cn.javabean.Student" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<!-- 核心标签库,C标签的使用 -->
</head>
<body>
<br/>------------c:out 输入内容到页面上---------
<%pageContext.setAttribute("s1", "cgx");
pageContext.setAttribute("s2","<h1>zxt</h1>");
%>
${s1}<br/>
<c:out value="${s1}"></c:out>
<c:out value="${s3}" default="没有"></c:out>
<c:out value="${s2}" escapeXml="false"></c:out>
<br/>----------c:set 设置值------------------<br/>
<!-- 把某个值放到指定的域中 -->
<c:set value="ppp" var="p" scope="page"></c:set>
${pageScope.p}<br/>
<!-- 设置javaBean的属性 -->
<%pageContext.setAttribute("s4", new Student()); %>
<c:set property="name" value="董乐强" target="${s4}"></c:set>
<c:set property="gender" value="男" target="${s4}"></c:set>
${s4.name}--${s4.gender} <br/>
<!-- 设置Map的key和value --><br/>
<%Map map = new HashMap();
pageContext.setAttribute("map", map);
%>
<c:set value="vvvvv" property="keyName" target="${map}"></c:set>
${map.keyName}<br/>
<!-- c:remove 从指定范围删除数据.如果没有指定,则删除所有 --><br/>
<% pageContext.setAttribute("s5", "pageS5");
request.setAttribute("s5", "requestS5");
%>
page:${pageScope.s5}<br/>
request:${requestScope.s5}<br/>
<c:remove var="s5" scope="page"/>
page:${pageScope.s5}<br/>
request:${requestScope.s5}<br/>
<c:remove var="s5" scope="request"/>
page:${pageScope.s5}<br/>
request:${requestScope.s5}<br/>
<!-- c:catch 相当于Java catch 代码块 --><br/>
<c:catch var="e">
${s19.gender }
</c:catch>
异常信息:${e.message } <br/>
<!-- c:if标签 ,相当于Java if语句 -->
<c:if test="${1>0}" var="result" scope="page">真</c:if>
<br/> ${pageScope.result }
<!-- c:choose c:when c:otherwise 类似java的 if else if -->
<% pageContext.setAttribute("grade", "D");
%>
<c:choose>
<c:when test="${grade=='A' }">优秀</c:when>
<c:when test="${grade=='B' }">良好</c:when>
<c:when test="${grade=='C' }">及格</c:when>
<c:when test="${grade=='D' }">太差了</c:when>
<c:otherwise > 回家吧</c:otherwise>
</c:choose>
</body>
</html>
<%@page import="com.tinysoft.cn.javabean.Student" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<!-- 核心标签库,C标签的使用 -->
</head>
<body>
<br/>------------c:out 输入内容到页面上---------
<%pageContext.setAttribute("s1", "cgx");
pageContext.setAttribute("s2","<h1>zxt</h1>");
%>
${s1}<br/>
<c:out value="${s1}"></c:out>
<c:out value="${s3}" default="没有"></c:out>
<c:out value="${s2}" escapeXml="false"></c:out>
<br/>----------c:set 设置值------------------<br/>
<!-- 把某个值放到指定的域中 -->
<c:set value="ppp" var="p" scope="page"></c:set>
${pageScope.p}<br/>
<!-- 设置javaBean的属性 -->
<%pageContext.setAttribute("s4", new Student()); %>
<c:set property="name" value="董乐强" target="${s4}"></c:set>
<c:set property="gender" value="男" target="${s4}"></c:set>
${s4.name}--${s4.gender} <br/>
<!-- 设置Map的key和value --><br/>
<%Map map = new HashMap();
pageContext.setAttribute("map", map);
%>
<c:set value="vvvvv" property="keyName" target="${map}"></c:set>
${map.keyName}<br/>
<!-- c:remove 从指定范围删除数据.如果没有指定,则删除所有 --><br/>
<% pageContext.setAttribute("s5", "pageS5");
request.setAttribute("s5", "requestS5");
%>
page:${pageScope.s5}<br/>
request:${requestScope.s5}<br/>
<c:remove var="s5" scope="page"/>
page:${pageScope.s5}<br/>
request:${requestScope.s5}<br/>
<c:remove var="s5" scope="request"/>
page:${pageScope.s5}<br/>
request:${requestScope.s5}<br/>
<!-- c:catch 相当于Java catch 代码块 --><br/>
<c:catch var="e">
${s19.gender }
</c:catch>
异常信息:${e.message } <br/>
<!-- c:if标签 ,相当于Java if语句 -->
<c:if test="${1>0}" var="result" scope="page">真</c:if>
<br/> ${pageScope.result }
<!-- c:choose c:when c:otherwise 类似java的 if else if -->
<% pageContext.setAttribute("grade", "D");
%>
<c:choose>
<c:when test="${grade=='A' }">优秀</c:when>
<c:when test="${grade=='B' }">良好</c:when>
<c:when test="${grade=='C' }">及格</c:when>
<c:when test="${grade=='D' }">太差了</c:when>
<c:otherwise > 回家吧</c:otherwise>
</c:choose>
</body>
</html>