FileDocCategorySizeDatePackage
SimpleSession.javaAPI DocExample1604Wed Feb 11 14:22:22 GMT 2004com.jspservletcookbook

SimpleSession

public class SimpleSession extends HttpServlet

Fields Summary
Constructors Summary
Methods Summary
public voiddoGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

        
        response.setContentType("text/html");
        java.io.PrintWriter out = response.getWriter();
        HttpSession session = request.getSession();
        
        out.println("<html>");
        out.println("<head>");
        out.println("<title>Simple Session Tracker</title>");
        out.println("</head>");
        out.println("<body>");
        
        out.println("<h2>Session Info</h2>");
        out.println("session Id: " + session.getId() + "<br><br>");
        out.println( "The SESSION TIMEOUT period is " + session.getMaxInactiveInterval() + " seconds.<br><br>");
        out.println( "Now changing it to 20 minutes.<br><br>");
        session.setMaxInactiveInterval(20 * 60);
        out.println("The SESSION TIMEOUT period is now " + session.getMaxInactiveInterval()  + " seconds.");
        
        out.println("</body>");
        out.println("</html>");
        

    
protected voiddoPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Handles the HTTP POST method.

param
request servlet request
param
response servlet response

       
    doGet(request,response);