- 论坛徽章:
- 0
|
刚刚学习Servlet,写了人简单的程序,可是却不知道怎么样能看到它的运行结果.我晕啊!
小程序:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Hello extends HttpServlet
{ static final long serialVersionUID =1l;
public void init(ServletConfig config) throws ServletException
{super.init(config);
}
public void service(HttpServletRequest reqest,HttpServletResponse response) throws IOException
{
PrintWriter out=response.getWriter();
response.setContentType("text/html;charset=GB2312");
out.println("<HTML> <BODY>");
out.println("Simple servlet");
out.println("</body> </html>");
}
}
我不知道怎么在tomcat下运行.看看书上写的放在classes目录中.然后在IE里写入URL.
http://localhost:8080/servlets/Hello
可是不好使啊. |
|