网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

servlet与springboot-创新互联

@WebServlet(name = "httpServletDemo",
        urlPatterns = "/httpServletDemo",
        initParams = {
        @WebInitParam(name = "name", value = "username"),
        @WebInitParam(name = "mobile", value = "1232423434")
})
@Controller
public class HttpServletDemo extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String name = getInitParameter("name");
        String mobile = getInitParameter("mobile");
        System.out.println("name:"+name+"; mobile:"+mobile);
        resp.getWriter().print("this is a demo");
        resp.setStatus(200);
    }

    @Override
    protected long getLastModified(HttpServletRequest req) {
        return super.getLastModified(req);
    }

    @Override
    protected void doHead(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doHead(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }

    @Override
    protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPut(req, resp);
    }

    @Override
    protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doDelete(req, resp);
    }

    @Override
    protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doOptions(req, resp);
    }

    @Override
    protected void doTrace(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doTrace(req, resp);
    }

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.service(req, resp);
    }

    @Override
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
        String name = getInitParameter("name");
        String mobile = getInitParameter("mobile");
        System.out.println("name:"+name+"; mobile:"+mobile);
        super.service(req, res);
    }
}

spring boot 启动类

创新互联-专业网站定制、快速模板网站建设、高性价比根河网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式根河网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖根河地区。费用合理售后完善,十年实体公司更值得信赖。
@SpringBootApplication
@EnableEurekaClient
@ServletComponentScan(basePackages = {"com.example.demo.filter","com.example.demo.interceptor","com.example.demo.servlet"})
public class SpringWebDemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringWebDemoApplication.class, args);
    }
}

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


本文名称:servlet与springboot-创新互联
文章位置:http://bjjierui.cn/article/coegoc.html

其他资讯