Simple Example
public class GetSession extends HttpServlet {
static final String myURL = . . . URL of this servlet . . . ;
public void doGet(HttpServletRequest req,
HttpServletResponse resp) throws . . . {
HttpSession session = req.getSession(true) ;
resp.setContentType(“text/html”) ;
PrintWriter out = resp.getWriter() ;
out.println(“<html><body><head></head>”) ;
out.println(“<a href=” + resp.encodeURL(myURL) + “>” +
“View servlet again</a>”) ;
out.println(“</html></body>”) ;