帮帮我,我学习的第一个简单的SERVLET程序运行报错
我的运行环境win98、TOMCAT、JCreator,servlet程序如下
class t extends HttpServlet{
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws IOException ,ServletException
{
response.setContentType("text/html");
PrintWriter out=response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Hello World!</title>");
out.println("<html>");
out.println("</head>");
out.println("<body>");
out.println("<h1>ok</h1>");
out.println("</body>");
out.println("</html>");
}
}
运行http://localhost:8080/examples/servlet/t
提示出现以下错误:
javax.servlet.ServletException: Cannot allocate servlet instance for path /examples/servlet/t
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:415)
.....
请问这是什么问题呀?感激不尽!
问题点数:40、回复次数:4Top
1 楼peppi(静坐听风)回复于 2002-11-20 15:08:13 得分 10
编译了吗?编译后放在web-inf/classes下Top
2 楼xiaofenguser(风雨)回复于 2002-11-20 15:41:38 得分 10
import语句写了吗?
另:
class t extends HttpServlet
应该加public在class前
改成public class t extends HttpServletTop
3 楼yinxp2(无线愚人)回复于 2002-11-20 16:03:51 得分 10
编译后放在web-inf/classes下,并以http://localhost:8080/servlet/t运行Top
4 楼lsj_smile(兰德里尼)回复于 2002-11-20 20:27:10 得分 10
编译后放在web-inf/classes下,别忘了启动tomcat.并以http://localhost:8080/servlet/t运行
Top




