在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、