博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
03007_HttpServlet
阅读量:4704 次
发布时间:2019-06-10

本文共 989 字,大约阅读时间需要 3 分钟。

1、创建

    new---Servlet

  

  

  

  

1 package com.gzdlh.servlet; 2  3 import java.io.IOException; 4 import javax.servlet.ServletException; 5 import javax.servlet.http.HttpServlet; 6 import javax.servlet.http.HttpServletRequest; 7 import javax.servlet.http.HttpServletResponse; 8  9 public class QuickStartServlet2 extends HttpServlet {10 11     protected void doGet(HttpServletRequest request, HttpServletResponse response)12             throws ServletException, IOException {13         response.getWriter().append("Served at: ").append(request.getContextPath());14     }15 16     protected void doPost(HttpServletRequest request, HttpServletResponse response)17             throws ServletException, IOException {18         doGet(request, response);19     }20 21 }

2、如果提示:servlet名字已经存在,很常见的一种情况是:你开始建了一个这样名字的servlet然后你删除了这个java文件,但是根据servlet2.5规范,web.xml里面存有这个servlet的映射关系,但是删除的时候,ide并不智能它没有把web.xml里面的映射关系删除,需要自己手动删除。

3、修改Servlet模板

  

  

  

 

转载于:https://www.cnblogs.com/gzdlh/p/8201824.html

你可能感兴趣的文章
web自动化之验证码识别解决方案
查看>>
netty接收大文件的方法
查看>>
软件工程设计之四则运算
查看>>
SpringMVC @ResponseBody 406
查看>>
HDOJ---2824 The Euler function[欧拉函数]
查看>>
KMP算法
查看>>
Atlas学习之开始篇[转]
查看>>
第二章 在HTML页面里使用javaScript
查看>>
【Educational Codeforces Round 48 (Rated for Div. 2) D】Vasya And The Matrix
查看>>
正则表达式的性能评测
查看>>
CF1172B Nauuo and Circle
查看>>
CF1178D Prime Graph
查看>>
CF1190D Tokitsukaze and Strange Rectangle
查看>>
CF1202F You Are Given Some Letters...
查看>>
CF1179C Serge and Dining Room
查看>>
CF1168B Good Triple
查看>>
CF1208E Let Them Slide
查看>>
CF1086E Beautiful Matrix
查看>>
在单位上班的25条建议(建议收藏)
查看>>
web前端--http协议
查看>>