Hi, gurus,
I encountered a problem when testing
a servlet.
When I run it, it gives me the
following error:
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";
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");
res.setContentType("text/html");
// then write the data of the
response
out = res.getWriter();
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();
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();
}
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
