1. Home (fill in the name) (optional, form post to time.jsp can):
Slightly
2. Judging time forward to different pages:
TIME.JSP:
Copy Code code as follows:
<%--
Document:index
Created on:2009-10-3, 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"%>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title>jsp page</title>
<body>
<%
Date dat =
New Date ();
if (dat.gethours () <= 12) {
%>
<jsp:forward page= "amgreeting.jsp"/>
<%}
else{
%>
<jsp:forward page= "pmgreeting.jsp"/>
<%}
%>
</body>
3. If it's morning:
AMGREETING.JSP:
Copy Code code as follows:
<%--
Document:amgreeting
Created on:2009-10-3, 16:00:10
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" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title>jsp page</title>
<body>
<%
String name = Request.getparameter ("UserName");
OUT.PRINTLN (name);
%>
!!!
</body>
If it's afternoon:
PMGREETING.JSP:
Copy Code code as follows:
<%--
Document:amgreeting
Created on:2009-10-3, 16:00:10
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" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title>jsp page</title>
<body>
<%
String name = Request.getparameter ("UserName");
OUT.PRINTLN (name);
%>
!!!
</body>