This is exactly the piece of code , i m using. Hope it is clear now. - shiva.
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException
{
HttpSession session = request.getSession();
String refNo = (String)session.getValue("refStatus");
String htmlDir = (String)session.getValue("htmlDir");
String notes =request.getParameter("tx"); // returns the text entered in the text area of the pop up window, where "tx" is the name of the text area.
PrintWriter out = response.getWriter();
out.println(" <html> ");
out.println(" <head> ");
out.println(" <script language='javascript'> ");
out.println(" { ");
out.println(" window.close(); ");
out.println(" } ");
out.println(" </script> ");
out.println(" </head> ");
out.println(" </html> ");
} // doPost