123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1" session="true"%>
- <!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=ISO-8859-1">
- <title>Insert title here</title>
- </head>
- <body>
- <center>
- <font color="red" size=5><u>This is page three</u></font> <br /> <br />
- <%
- java.time.format.DateTimeFormatter dtf1 = java.time.format.DateTimeFormatter
- .ofPattern("yyyy/MM/dd HH:mm:ss");
- java.time.LocalDateTime now1 = java.time.LocalDateTime.now();
- %>
- Current time :
- <%=now1%></center>
- <br />
- <%
- session = request.getSession();
- String nameVal = "null name";
- String tmVal = "null time";
- if (null != session.getAttribute("name")) {
- nameVal = String.valueOf(session.getAttribute("name"));
- }
- //out.println("<br/>3rd page : " + nameVal);
- if (null != session.getAttribute("currTime")) {
- tmVal = session.getAttribute("currTime").toString();
- }
- //out.println("<br/><br/>Time is : " + tmVal);
- if ("Go Back".equals(request.getParameter("bSubmit"))) {
- session.setAttribute("name", request.getParameter("tName"));
- java.time.format.DateTimeFormatter dtf = java.time.format.DateTimeFormatter
- .ofPattern("yyyy/MM/dd HH:mm:ss");
- java.time.LocalDateTime now = java.time.LocalDateTime.now();
- //System.out.println(dtf.format(now));
- session.setAttribute("currTime", now);
- %>
- <jsp:forward page="home.jsp" />
- <%
- }
- %>
- <form action="thirdpage.jsp" method="get">
- <table align="center">
- <tr>
- <td>Session Text :</td>
- <td><%=nameVal%></td>
- </tr>
- <tr>
- <td></td>
- </tr>
- <tr>
- <td>Session Time :</td>
- <td><%=tmVal%></td>
- </tr>
- <tr>
- <td></td>
- </tr>
- <tr>
- <td></td>
- </tr>
- <tr>
- <td>Enter Name :</td>
- <td><input type="text" name="tName">
- <td>
- </tr>
- <tr>
- <td colspan="2"><input type="submit" name="bSubmit"
- value="Go Back"></td>
- </tr>
- </table>
- </form>
- </body>
- </html>
|