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

public class SessionId extends HttpServlet
{
	public void doGet(HttpServletRequest req, HttpServletResponse res)
		throws IOException, ServletException
	{
			res.setContentType("text/html");
			PrintWriter pw = res.getWriter();
		HttpSession ssn = req.getSession();
		if(ssn != null){
			pw.println("Your session Id is : ");
			String ssnId = ssn.getId();
			pw.println(ssnId);
		}
		else
		{
			pw.println("Your session is not created yet");
		}
	}
}