在eclipse中开发servlet流程

1、新建一个web工程--Dynamic Web Project ,配置相关设置

2、功能当中编写程序。如;   

public class HelloServlet extends GenericServlet {

@Override
public void service(ServletRequest req, ServletResponse res)
throws ServletException, IOException {
OutputStream out = res.getOutputStream();
out.write("hello servlet".getBytes());

}

3、web.xml文件配置servlet:  

<servlet>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>/servletstudy/src/wdyweb/HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet</url-pattern>
</servlet-mapping>

4、

 

posted @ 2016-12-29 18:22  贱贱的小帅哥  阅读(223)  评论(0编辑  收藏  举报