<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7378517048028389721</id><updated>2024-09-16T19:57:16.024-07:00</updated><category term="Servlet"/><title type='text'>IT Programs(C,C++,C#,J2SE,J2EE,VC#,ASP.Net)</title><subtitle type='html'>Learn Online ASP.NET, VC# , VB.NET , C , C++ , C#,JAVA , J2EE  Programs.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://itprogramsforyou.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7378517048028389721/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://itprogramsforyou.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Dilip Bari</name><uri>http://www.blogger.com/profile/16483134944407910695</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7378517048028389721.post-8486094221898874009</id><published>2012-03-02T01:02:00.002-08:00</published><updated>2012-03-02T01:02:44.212-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Servlet"/><title type='text'>Session Management Techniques in Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
Session management is the process of keeping track of the activities of a user across&lt;br /&gt;Web pages. Consider an example of an online shopping mall. The user can choose a&lt;br /&gt;product and add it to the shopping cart. When the user moves to a different page, the&lt;br /&gt;details in the shopping cart are still retained, so that the user can check the items in&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Messenger service in which the user name and the password are saved and displayed automatically as soon as you visit a web site.&lt;/li&gt;
&lt;li&gt;Some of the web sites track your email id and automatically start sending free subscription of their newsletters to the mail address.&lt;/li&gt;
&lt;/ol&gt;
&lt;strong&gt;&lt;u&gt;Session Management Techniques:&lt;/u&gt;&lt;/strong&gt;HTTP is a stateless protocol and therefore cannot store the information about the user&lt;br /&gt;activities across Web pages. However, there are certain techniques that helps store&lt;br /&gt;the user information across Web pages using HTTP protocol. The techniques that you&lt;br /&gt;can use to maintain the session information are:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1)Hidden form field&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2)URL rewriting&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3)Cookies&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4)Servlet session API&lt;br /&gt;
&lt;strong&gt;&lt;u&gt;Using Cookies&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;Cookies are small text files that are stored by an application server in the client&lt;br /&gt;browser to keep track of all the users. A cookie has values in the form of name/value pairs.&lt;br /&gt;
&lt;strong&gt;Note:Cookies will not work if they are disabled in the browser.&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: blue;&quot;&gt;Jsp Page:index.jsp&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: #ffffc4; border-bottom-color: rgb(0, 0, 160); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(0, 0, 160); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(0, 0, 160); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(0, 0, 160); border-top-style: solid; border-top-width: 1px; height: 472px; min-height: 40px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 660px;&quot;&gt;&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; height: 4px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 652px;&quot;&gt;&amp;amp;lt;%-- &lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;    Document   : index&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;    Created on : Feb 28, 2012, 3:32:07 PM&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;    Author     : dell_pc&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;--%&amp;amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;&amp;amp;lt;%@page contentType=&quot;&lt;span style=&quot;color: darkred;&quot;&gt;text/html&lt;/span&gt;&quot; pageEncoding=&quot;&lt;span style=&quot;color: darkred;&quot;&gt;UTF-8&lt;/span&gt;&quot;%&amp;amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;&amp;amp;lt;!DOCTYPE HTML PUBLIC &quot;&lt;span style=&quot;color: darkred;&quot;&gt;-//W3C//DTD HTML 4.01 Transitional//EN&lt;/span&gt;&quot;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;   &quot;&lt;span style=&quot;color: darkred;&quot;&gt;http://www.w3.org/TR/html4/loose.dtd&lt;/span&gt;&quot;&amp;amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;&amp;amp;lt;html&amp;amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;    &amp;amp;lt;head&amp;amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;        &amp;amp;lt;meta http-equiv=&quot;&lt;span style=&quot;color: darkred;&quot;&gt;Content-Type&lt;/span&gt;&quot; content=&quot;&lt;span style=&quot;color: darkred;&quot;&gt;text/html; charset=UTF-8&lt;/span&gt;&quot;&amp;amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;        &amp;amp;lt;title&amp;amp;gt;JSP Page&amp;amp;lt;/title&amp;amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;    &amp;amp;lt;/head&amp;amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;    &amp;amp;lt;body&amp;amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;        &amp;amp;lt;h1&amp;amp;gt;Access Servlet by servlet&#39;s Name!&amp;amp;lt;/h1&amp;amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;       &lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;        &amp;amp;lt;a href=&quot;&lt;span style=&quot;color: darkred;&quot;&gt;CookieServlet&lt;/span&gt;&quot;&amp;amp;gt;CookieServlet&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;br&amp;amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;        &amp;amp;lt;a href=&quot;&lt;span style=&quot;color: darkred;&quot;&gt;SessionTrackerServlet&lt;/span&gt;&quot;&amp;amp;gt;SessionTrackerServlet&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;br&amp;amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;        &lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;     &amp;amp;lt;/body&amp;amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;&amp;amp;lt;/html&amp;amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 660px;&quot;&gt;&lt;/pre&gt;
&lt;/pre&gt;
&lt;pre style=&quot;background-color: #ffffc4; font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 651px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;Servlet:CookieServlet&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #ffffc4; border-bottom-color: rgb(0, 0, 160); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(0, 0, 160); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(0, 0, 160); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(0, 0, 160); border-top-style: solid; border-top-width: 1px; min-height: 40px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 665px;&quot;&gt;&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;/*&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt; * To change this template, choose Tools | Templates&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt; * and open the template in the editor.&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt; */&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;package&lt;/span&gt; servlet;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;import&lt;/span&gt; java.io.IOException;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;import&lt;/span&gt; java.io.PrintWriter;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;import&lt;/span&gt; javax.servlet.ServletException;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;import&lt;/span&gt; javax.servlet.http.Cookie;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;import&lt;/span&gt; javax.servlet.http.HttpServlet;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;import&lt;/span&gt; javax.servlet.http.HttpServletRequest;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;import&lt;/span&gt; javax.servlet.http.HttpServletResponse;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;/**&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt; *&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt; * @author dell_pc&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt; */&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; CookieServlet &lt;span style=&quot;color: blue;&quot;&gt;extends&lt;/span&gt; HttpServlet {&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; Cookie cookie;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;protected&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; processRequest(HttpServletRequest request, HttpServletResponse response)&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;throws&lt;/span&gt; ServletException, IOException {&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;response.setContentType(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;text/html;charset=UTF-8&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;PrintWriter out = response.getWriter();&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;try&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;/* TODO output your page here */&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;html&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;head&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;title&amp;amp;gt;&lt;/span&gt;&quot; + getServletInfo() + &quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;/title&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;/head&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;body&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;h1&amp;amp;gt;Servlet CookieServlet at &lt;/span&gt;&quot; + request.getContextPath() + &quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;/h1&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;form name=\&quot;form\&quot; action=\&quot;CookieServlet\&quot; method=\&quot;POST\&quot;&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;BR&amp;amp;gt;Username:&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;input type=\&quot;text\&quot; name=\&quot;user\&quot; value=\&quot;\&quot; size=\&quot;20\&quot; /&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;BR&amp;amp;gt;Password :&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;input type=\&quot;password\&quot; name=\&quot;pass\&quot; value=\&quot;\&quot; size=\&quot;20\&quot; /&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;BR&amp;amp;gt; &amp;amp;lt;input type=\&quot;submit\&quot; value=\&quot;Submit Form\&quot; name=\&quot;submit\&quot; /&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;input type=\&quot;reset\&quot; value=\&quot;Reset \&quot; /&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;/form&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;/body&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;/html&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;} &lt;span style=&quot;color: blue;&quot;&gt;finally&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.close();&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;}&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;}&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;    @Override&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;protected&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; doGet(HttpServletRequest request, HttpServletResponse response)&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;throws&lt;/span&gt; ServletException, IOException {&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;processRequest(request, response);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;}&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;    @Override&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;protected&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; doPost(HttpServletRequest request, HttpServletResponse response)&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;throws&lt;/span&gt; ServletException, IOException {&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;// processRequest(request, response);&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;response.setContentType(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;text/html;charset=UTF-8&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;PrintWriter out = response.getWriter();&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;// get value form TextField&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;String username = request.getParameter(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;user&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;String password = request.getParameter(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;pass&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;// User don&#39;t allow to leave any textfield empty&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; ((!username.equals(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&lt;/span&gt;&quot;) &amp;amp;amp;&amp;amp;amp; (!password.equals(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&lt;/span&gt;&quot;)))) {&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;String cookieValue = username + &quot;&lt;span style=&quot;color: darkred;&quot;&gt; &lt;/span&gt;&quot; + password;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;cookie = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; Cookie(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;cookiee&lt;/span&gt;&quot;, cookieValue); &lt;span style=&quot;color: green;&quot;&gt;// initialize cookie&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;cookie.setMaxAge(100);                                                                                                                                     &lt;span style=&quot;color: green;&quot;&gt;// set cookie max age&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;cookie.setVersion(1);                                                                                                                                           &lt;span style=&quot;color: green;&quot;&gt;// set cookie version&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;response.addCookie(cookie);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;html&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;head&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;title&amp;amp;gt;&lt;/span&gt;&quot; + getServletInfo() + &quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;/title&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;/head&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;body&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;// retrive cookiee value and display cookiee information&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;b&amp;amp;gt;Data successfully add into cookiee&amp;amp;lt;/b&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;br&amp;amp;gt;Cookiee Name: &lt;/span&gt;&quot; + cookie.getName());&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;br&amp;amp;gt;Cookiee Value : &lt;/span&gt;&quot; + cookie.getValue());&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;br&amp;amp;gt;Cookiee Version : &lt;/span&gt;&quot; + cookie.getVersion());&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;/body&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;/html&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;} &lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;Please don&#39;t leave any textfield empty!&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.println(&quot;&lt;span style=&quot;color: darkred;&quot;&gt;&amp;amp;lt;BR&amp;amp;gt;&amp;amp;lt;a href=\&quot;CookieServlet\&quot;&amp;amp;gt;Return to home Page&amp;amp;lt;/a&amp;amp;gt;&lt;/span&gt;&quot;);&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;}&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;out.close(); &lt;span style=&quot;color: green;&quot;&gt;//close text-output stream&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;}&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;    @Override&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; String getServletInfo() {&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; &quot;&lt;span style=&quot;color: darkred;&quot;&gt;CookieServlet&lt;/span&gt;&quot;;&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;}&lt;/pre&gt;
&lt;pre style=&quot;font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 14px; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; width: 665px;&quot;&gt;}&lt;/pre&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: blue;&quot;&gt;Output:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://lh5.ggpht.com/-PcezvT7Cxkw/T039IN0Tl0I/AAAAAAAAByI/Lt-OVUrDbmM/s1600-h/jsp%25255B4%25255D.jpg&quot;&gt;&lt;img alt=&quot;jsp&quot; border=&quot;0&quot; height=&quot;225&quot; src=&quot;http://lh5.ggpht.com/-QBDvek7Ia4M/T039JdhiTUI/AAAAAAAAByQ/MxBN9EkJzwM/jsp_thumb%25255B2%25255D.jpg?imgmax=800&quot; style=&quot;background-image: none; border-bottom-color: initial; border-bottom-style: initial; border-bottom-width: 0px; border-left-color: initial; border-left-style: initial; border-left-width: 0px; border-right-color: initial; border-right-style: initial; border-right-width: 0px; border-top-color: initial; border-top-style: initial; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;jsp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://lh4.ggpht.com/-ZQcDteCu8WI/T039KVvF-FI/AAAAAAAAByY/NSbi8uOACIk/s1600-h/cookies%25255B4%25255D.jpg&quot;&gt;&lt;img alt=&quot;cookies&quot; border=&quot;0&quot; height=&quot;177&quot; src=&quot;http://lh4.ggpht.com/-R-gjdvWn0lg/T039LrPohTI/AAAAAAAAByg/0fKaWdByAhk/cookies_thumb%25255B2%25255D.jpg?imgmax=800&quot; style=&quot;background-image: none; border-bottom-color: initial; border-bottom-style: initial; border-bottom-width: 0px; border-left-color: initial; border-left-style: initial; border-left-width: 0px; border-right-color: initial; border-right-style: initial; border-right-width: 0px; border-top-color: initial; border-top-style: initial; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;cookies&quot; width=&quot;321&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://lh4.ggpht.com/-xIGgkXl-3cg/T039M0T_WKI/AAAAAAAAByo/l4HadX0kLt8/s1600-h/servletout%25255B4%25255D.jpg&quot;&gt;&lt;img alt=&quot;servletout&quot; border=&quot;0&quot; height=&quot;200&quot; src=&quot;http://lh3.ggpht.com/-MVk3-q0KRs4/T039Nzam6EI/AAAAAAAAByw/BCH2Zs8WpOQ/servletout_thumb%25255B2%25255D.jpg?imgmax=800&quot; style=&quot;background-image: none; border-bottom-color: initial; border-bottom-style: initial; border-bottom-width: 0px; border-left-color: initial; border-left-style: initial; border-left-width: 0px; border-right-color: initial; border-right-style: initial; border-right-width: 0px; border-top-color: initial; border-top-style: initial; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;servletout&quot; width=&quot;325&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://itprogramsforyou.blogspot.com/feeds/8486094221898874009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://itprogramsforyou.blogspot.com/2012/03/session-management-techniques-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7378517048028389721/posts/default/8486094221898874009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7378517048028389721/posts/default/8486094221898874009'/><link rel='alternate' type='text/html' href='http://itprogramsforyou.blogspot.com/2012/03/session-management-techniques-in-java.html' title='Session Management Techniques in Java'/><author><name>Dilip Bari</name><uri>http://www.blogger.com/profile/16483134944407910695</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-QBDvek7Ia4M/T039JdhiTUI/AAAAAAAAByQ/MxBN9EkJzwM/s72-c/jsp_thumb%25255B2%25255D.jpg?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry></feed>