[jsp]代码库
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
int weekDay = 3;
request.setAttribute("weekday", weekDay);
%>
<!-- 主要用于取代 java 代码中 switch ... case 语句 -->
<c:choose>
<c:when test="${weekday==1 }">
星期一
</c:when>
<c:when test="${weekday==2 }">
星期二
</c:when>
<c:when test="${weekday==3 }">
星期三
</c:when>
<c:otherwise>
星期日
</c:otherwise>
</c:choose>
</body>
</html>