1、新建web_maven工程
建工程
web_project——>suportMaven——>generate web.xml——>standard Maven Project
2嗦哆、pom.xml中添加servelet依賴
javax.servletjavax.servlet-api3.0.1provided
3剩膘、開發(fā)http接口(繼承HTTPServlet類)
packagecom.guoyasoft;importjava.io.IOException;importjavax.servlet.ServletException;importjavax.servlet.http.HttpServlet;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;publicclassLoginextendsHttpServlet{@OverrideprotectedvoiddoGet(HttpServletRequest req, HttpServletResponse resp)throwsServletException, IOException{ System.out.println("------------login doGet-----------------");super.doGet(req, resp); }@OverrideprotectedvoiddoPost(HttpServletRequest req, HttpServletResponse resp)throwsServletException, IOException{ System.out.println("-------------login doGet-----------------");super.doPost(req, resp); }}