Hi, gurus,
 
I encountered a problem when testing a servlet.
When I run it, it gives me the following error:
 
java.lang.OutOfMemoryError
        at CrawlServlet.doPost(Compiled Code)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:747)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
        at com.sun.web.core.ServletWrapper.handleRequest(ServletWrapper.java:140)
        at com.sun.web.core.InvokerServlet.service(InvokerServlet.java:169)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
        at com.sun.web.core.ServletWrapper.handleRequest(ServletWrapper.java:140)
        at com.sun.web.core.Context.handleRequest(Context.java:375)
        at com.sun.web.server.ConnectionHandler.run(Compiled Code)
 
Here is the code of the servlet.
 protected void doPost(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
 {
  String strKey = req.getParameter("txtKeyword").trim();
  String strCat = req.getParameter("category").trim();
  String strMatch = req.getParameter("radMatch").trim();
 
  PrintWriter  out;
  String  title = "KillerBiz";
 
  // set content type and other response header fields first
  res.setContentType("text/html");
 
  // then write the data of the response
  out = res.getWriter();
 
  out.println("<HTML><HEAD><TITLE>");
  out.println(title);
  out.println("</TITLE></HEAD><BODY>");
 
  out.println(readFromFile("killer1.txt"));    // read from file
  out.println(strKey);
  out.println(readFromFile("killer2.txt"));
  out.flush();
 
   int nCount = 3;
   for (int i=0; i<nCount; i++) {
     out.println(/* get from other place */);
     out.flush();
    }
   }
 
  out.println(readFromFile("killer3.txt"));
  out.flush();
  out.close();
 }
Any help would be appreciated.
Thank you in advance.
 
Jianhong
 

Reply via email to