<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=gb2312" language="java" %>
<html>
<head>
<title>JSTL:catch的使用</title>
</head>
<body bgcolor="#FFFFFF">
<c:catch var="error">
<%
Integer.parseInt("sdkfj");
%>
</c:catch>
<hr>异常:
<c:out value="${error}"/>
<hr>异常 exception.getMessage=
<c:out value="${error.message}"/>
<hr> 异常exception.getCause=
<c:out value="${error.cause}"/>
</body>
</html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=gb2312" language="java" %>
<c:set var="count" value="100"/>
<html>
<head>
<title>JSTL:c:choose的使用</title>
</head>
<body bgcolor="#FFFFFF">
<c:choose>
<c:when test="${count <=0}">
<font color="blue">
</c:when>
<c:when test="${count<=60&&count>0}">
<font color="red">
</c:when>
<c:otherwise>
<font color="green">
</c:otherwise>
</c:choose>
count的值是:<c:out value="${count}"/>
</font>
</body>
</html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=gb2312" language="java" %>
<html>
<head>
<title>JSTL:c:if的使用</title>
</head>
<body bgcolor="#FFFFFF">
<c:set var="count" value="100"/>
<c:if test="${count>78}">
count>78
</c:if>
</body>
</html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=gb2312" language="java" %>
<html>
<head>
<title>JSTL:c:import的使用</title>
</head>
<body bgcolor="#FFFFFF">
<h3>绝对路径 URL</h3>
<blockquote>
<ex:escapeHtml>
<c:import url="http://127.0.0.1:8080/ch12/footer.jsp"/>
</ex:escapeHtml>
</blockquote>
<h3>相对路径并且传递参数到指定的URL</h3>
<blockquote>
<c:import url="footer.jsp" charEncoding="gb2312">
<c:param name="userName" value="hellking"/>
</c:import>
</blockquote>
</body>
</html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=gb2312" language="java" %>
<html>
<head>
<title>JSTL: c:out的使用</title>
</head>
<body bgcolor="#FFFFFF">
<hr>
<c:set var="sessionAttr" value="sessionValue" scope="session"/>
<c:set var="pageAttr" value="pageValue" scope="page"/>
<c:set var="requestAttr" value="requestValue" scope="request"/>
<c:out value="以下输出的是前面设置的属性<br>" escapeXml="false"/>
<c:out value="${sessionAttr}"/>
<c:out value="${pageAttr}"/>
<c:out value="${requestAttr}"/>
<c:out value="${test_nodef}" default="没有test_nodef这个变量"/>
</html>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ page contentType="text/html; charset=gb2312" language="java" %>
<html>
<head>
<title>JSTL c:param的使用</title>
</head>
<body bgcolor="#FFFFFF">
<c:redirect url="footer.jsp">
<c:param name="userName">
hellking
</c:param>
</c:redirect>
</body>
</html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=gb2312" language="java" %>
<html>
<head>
<title>JSTL:c:redirect的使用</title>
</head>
<body bgcolor="#cc99cc">
<c:url value="footer.jsp" var="nextpage"><c:param name="userName" value="hellking"/></c:url>
<c:redirect url="${nextpage}"/>
</body>
</html>
dddd