<%@ page import="java.util.Date" %><%--
Created by IntelliJ IDEA.
User:
Date: 2023/9/15
Time: 14:37
To change this template use File | Settings | File Templates.
--%>
<%@ page import="java.util.*" contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>$Title$</title>
</head>
<body>
<%
Date a = new Date();
int hours = a.getHours();
if(0<hours&hours<8){
out.print("清晨好");
}
if(hours>=8&&hours<=12){
out.print("早上好");
}
if(hours>12&&hours<=24){
out.print("下午好");
}
%>
</body>
</html>
jsp根据系统时间输出不同内容
最新推荐文章于 2025-12-05 17:02:52 发布
这篇文章展示了如何使用Java编写简单的HTML页面,根据访问者当前时间输出不同的问候语,如清晨好、早上好和下午好。
558

被折叠的 条评论
为什么被折叠?



