CS506 Assignment No. 5 Solution
Page 1 of 1 • Share
CS506 Assignment No. 5 Solution
- Code:
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class STimerOut extends HttpServlet {
// Handles the HTTP <code>GET</code> method.
// use rq to read incoming HTTP headers
// use rs to specify the HTTP response status
public void doGet(HttpServletRequest rq, HttpServletResponse rs)
throws ServletException, IOException {
// tell the browser that we are sending back html
rs.setContentType(“text/html”);
// used to modify println() statements to build a legal web page
PrintWriter out = rs.getWriter();
int t = 60;
/*
system extracts a user ID from a cookie or attached URL data, then uses
that as a key into a table of previously created HttpSession objects.
*/
HttpSession s = rq.getSession();
/*
following statements build a legal webpage
*/
out.println(“<HTML>”);
out.println(“<HEAD>”);
out.println(“<TITLE >”);
out.println(“Session TimeOut “);
out.println(“</TITLE>”);
out.println(“</HEAD>”);
out.println(“<BODY>”);
out.println(“<H1>”);
out.println(“Session TimeOut “);
out.println(“</H1>”);
out.println(“gaining the old time out ” +
s.getMaxInactiveInterval());/* getMaxInactiveInterval() gets the maximum
time in seconds for which the session remained
inactive.
out.println(“<BR>”);
out.println(“<BR>”);
s.setMaxInactiveInterval(2*t*t); /* sets the maximum time in seconds for which the
session can remain inactive.
out.println(“giving new time to get out ” +
s.getMaxInactiveInterval());
out.println(“</BODY>”);
out.println(“</HTML>”);
Rao Muhammad Aftab- Monstars
-
Posts : 1091
Join date : 2011-02-11
Age : 35
Similar topics
» CS506 Assignment No.3 Solution Spring 2013
» MGT 431 Assignment No. 1 Solution
» ENG 301 Assignment No. 1 Solution
» ENG301 Assignment No. 4 Solution
» ECO402 Assignment No. 2 Solution
» MGT 431 Assignment No. 1 Solution
» ENG 301 Assignment No. 1 Solution
» ENG301 Assignment No. 4 Solution
» ECO402 Assignment No. 2 Solution
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
Yesterday at 12:21 pm by ali001
» Hemangiom'App
Tue Nov 05, 2024 11:25 am by ali001
» MindfulMe - Mental Health App
Mon Nov 04, 2024 10:50 am by ali001
» Learn Candlestick Patterns
Tue Oct 15, 2024 5:51 am by ali001
» Woh Pagal Si Episode 52 to 62 - Top Pakistani Drama
Sat Sep 21, 2024 6:26 pm by Mir Emmad Ali Khan Domki
» Nearu - share your socials
Sat Sep 21, 2024 1:12 pm by ali001
» Nightclub Tycoon: Idle Empire
Thu Sep 19, 2024 9:16 pm by ali001
» Carnivore - Meat Diet Recipes
Wed Sep 18, 2024 2:37 pm by ali001
» Eid Milad un Nabi Mubarak 2024 (Rabiʻ I 14, 1446 AH)
Tue Sep 17, 2024 3:44 pm by Mir Emmad Ali Khan Domki