1. homepage (enter a name) (optional, form post to time. jsp ):
Omitted
2. determine the time forward to different pages:
Time. jsp:
CopyCode The Code is as follows: <% --
Document: Index
Created on:, 15:48:00
Author: Lucifer
-- %>
<% @ Page contenttype = "text/html" pageencoding = "UTF-8" %>
<! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en"
Http://www.w3.org/TR/html4/loose.dtd>
<% @ Page import = "Java. util. Date" %>
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
<Title> JSP page </title>
</Head>
<Body>
<%
Date dat =
New Date ();
If (dat. gethours () <= 12 ){
%>
<JSP: Forward page = "amgreeting. jsp"/>
<%}
Else {
%>
<JSP: Forward page = "pmgreeting. jsp"/>
<%}
%>
</Body>
</Html>
3. if it is in the morning:
amgreeting. JSP: copy Code the code is as follows: <% --
document: amgreeting
created on:, 16:00:10
author: lucifer
-- %>
<% @ page contenttype = "text/html" pageencoding = "UTF-8" %>
"http://www.w3.org/TR/html4/loose.dtd">
JSP page
good morning!
<%
string name = request. getparameter ("username");
out. println (name);
%>
!!!
in the afternoon:
pmgreeting. JSP: copy Code the code is as follows: <% --
document: amgreeting
created on:, 16:00:10
author: lucifer
-- %>
<% @ page contenttype = "text/html" pageencoding = "UTF-8" %>
"http://www.w3.org/TR/html4/loose.dtd">
JSP page
Good afternoon!
<%
string name = request. getparameter ("username");
out. println (name);
%>
!!!