//Girl.java：
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Girl extends HttpServlet
{  public void init(ServletConfig config) throws ServletException
    {super.init(config);
    }
  public  void doPost(HttpServletRequest request,HttpServletResponse response) 
                        throws ServletException,IOException
    {  //获得一个向客户发送数据的输出流：
       PrintWriter out=response.getWriter();
       response.setContentType("text/html;charset=GB2312");//设置响应的MIME类型。
       out.println("<HTML>"); 
       out.println("<BODY>");
       HttpSession session=request.getSession(true);  //获取客户的会话对象
                   session.setAttribute("name","Zhoumin");
       out.println(session.getId());                  //获取会话的Id.
       String s=(String)session.getAttribute("name"); //获取会话中存储的数据。
       out.print("<BR>"+s);
       out.println("</BODY>");
       out.println("</HTML>");
    }
  public void doGet(HttpServletRequest request,HttpServletResponse response) 
                        throws ServletException,IOException
    { doPost(request,response);
    }
}