01-03-2012, 11:35 PM
Question:
Analyze following code using your best effort. And then give and explain its output. Yours explanation should not exceed 3-4 sentences. This assignment is based on negative marking if any unnecessary information or too much detail is provided your marks will be deducted.
[HTML]import java.io.*;import java.util.*;import javax.servlet.*;import javax.servlet.http.*; public class STimerOut extends HttpServlet
{ public void doGet(HttpServletRequest rq, HttpServletResponse rs) throws ServletException, IOException { rs.setContentType("text/html");
PrintWriter out = rs.getWriter(); int t = 60; HttpSession s = rq.getSession();
out.println("<HTML>"); out.println("<BODY>"); out.println("<H3>");
out.println(" Making Session based checkOut "); out.println("</H3>");
out.println("obtain previous time out " + s.getMaxInactiveInterval());
out.println("<BR>"); out.println("<BR>");
s.setMaxInactiveInterval(2*t*t);
// two hours
out.println("setting new time to get out " + s.getMaxInactiveInterval());
out.println("</BODY>");
out.println("</HTML>");
}}[/HTML]
Note: Your answer should be in [B]your own words and it should be concise and precise. (This means there can’t be multiple copies of your solution, if found will be treated as copy case.)[/B]
Analyze following code using your best effort. And then give and explain its output. Yours explanation should not exceed 3-4 sentences. This assignment is based on negative marking if any unnecessary information or too much detail is provided your marks will be deducted.
[HTML]import java.io.*;import java.util.*;import javax.servlet.*;import javax.servlet.http.*; public class STimerOut extends HttpServlet
{ public void doGet(HttpServletRequest rq, HttpServletResponse rs) throws ServletException, IOException { rs.setContentType("text/html");
PrintWriter out = rs.getWriter(); int t = 60; HttpSession s = rq.getSession();
out.println("<HTML>"); out.println("<BODY>"); out.println("<H3>");
out.println(" Making Session based checkOut "); out.println("</H3>");
out.println("obtain previous time out " + s.getMaxInactiveInterval());
out.println("<BR>"); out.println("<BR>");
s.setMaxInactiveInterval(2*t*t);
// two hours
out.println("setting new time to get out " + s.getMaxInactiveInterval());
out.println("</BODY>");
out.println("</HTML>");
}}[/HTML]
Note: Your answer should be in [B]your own words and it should be concise and precise. (This means there can’t be multiple copies of your solution, if found will be treated as copy case.)[/B]

mileys44: