创建jsp程序使用<c:choose>获取当前系统时间是星期几
时间: 2024-05-19 18:15:48 浏览: 62
<%@ page language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>获取当前星期</title>
</head>
<body>
<c:set var="dayOfWeek" value="<%= new java.util.Date().getDay() %>"/>
<c:choose>
<c:when test="${dayOfWeek == 0}">
<p>星期日</p>
</c:when>
<c:when test="${dayOfWeek == 1}">
<p>星期一</p>
</c:when>
<c:when test="${dayOfWeek == 2}">
<p>星期二</p>
</c:when>
<c:when test="${dayOfWeek == 3}">
<p>星期三</p>
</c:when>
<c:when test="${dayOfWeek == 4}">
<p>星期四</p>
</c:when>
<c:when test="${dayOfWeek == 5}">
<p>星期五</p>
</c:when>
<c:when test="${dayOfWeek == 6}">
<p>星期六</p>
</c:when>
</c:choose>
</body>
</html>
阅读全文