import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CheckSessionStatus extends HttpServlet
{
	public void doGet(HttpServletRequest req, HttpServletResponse res)
		throws IOException, ServletException
		{
			HttpSession ssn = req.getSession();
			PrintWriter pw = res.getWriter();
			res.setContentType("text/html");
			if(ssn.isNew())
			{
				pw.println("A new session is created");
			}
			else
			{
				pw.println("The session is already existed");
			}
				
		}

}
