web应用整体串联

2017-12-11  本文已影响0人  zcm0210

1、新建web_maven工程

建工程

web_project——>suportMaven——>generate web.xml——>standard Maven Project

2、pom.xml中添加servelet依赖

javax.servletjavax.servlet-api3.0.1provided

3、开发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); }}

上一篇下一篇

猜你喜欢

热点阅读