• request常用方法servlet初步


     

     1 package com.ycw.newservlet;
     2 
     3 import java.io.IOException;
     4 import javax.servlet.ServletException;
     5 import javax.servlet.annotation.WebServlet;
     6 import javax.servlet.http.HttpServlet;
     7 import javax.servlet.http.HttpServletRequest;
     8 import javax.servlet.http.HttpServletResponse;
     9 
    10 /**
    11  * Servlet implementation class MyServlet
    12  */
    13 @WebServlet("/MyServlet")
    14 public class MyServlet extends HttpServlet {
    15     private static final long serialVersionUID = 1L;
    16        @Override
    17        
    18     public void init() throws ServletException {
    19         // TODO 自动生成的方法存根
    20         super.init();
    21     }
    22     /**
    23      * @see HttpServlet#HttpServlet()
    24      */
    25     public MyServlet() {
    26         super();
    27         // TODO Auto-generated constructor stub
    28     }
    29 
    30     /**
    31      * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
    32      */
    33     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    34         // TODO Auto-generated method stub
    35         response.getWriter().append("Served at: ").append(request.getContextPath());
    36     }
    37 
    38     /**
    39      * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
    40      */
    41     protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    42         // TODO Auto-generated method stub
    43         doGet(request, response);
    44     }
    45 
    46 }
  • 相关阅读:
    .NET Core 服务调用 RPC
    从Docker 到 Kubernatetes 的跃迁之路
    同步异步-多线程梳理
    Net的微服务选型之路
    Visual Studio 2019安装SSIS
    HL7协议的基本语法
    vue学习笔记
    开发常用的部分sql语句总结
    VSPD虚拟串口来调试通信接口程序
    SSRS报表工具之合并行数据
  • 原文地址:https://www.cnblogs.com/rainbow-1/p/14008361.html
Copyright © 2020-2023  润新知