zoukankan      html  css  js  c++  java
  • JAVA框架-Servlet上

    package day27;

    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    /**

    • Servlet implementation class LoginServlet
      */
      @WebServlet("/LoginServlet")
      public class LoginServlet extends HttpServlet {
      private static final long serialVersionUID = 1L;

      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      // TODO Auto-generated method stub
      System.out.println("服务器收到get请求!");
      String username = request.getParameter("username");
      String password = request.getParameter("password");
      System.out.println("用户名:"+username );
      System.out.println("密码:"+ password);
      }

      protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      // TODO Auto-generated method stub
      System.out.println("服务器收到post请求!");
      String username = request.getParameter("username");
      String password = request.getParameter("password");
      System.out.println("用户名:"+username );
      System.out.println("密码:"+ password);
      }

    }

    /*
    服务器收到post请求!
    用户名:123
    密码:1111
    服务器收到get请求!
    用户名:1234
    密码:22222222
    */

  • 相关阅读:
    数据库
    linux
    linux
    python_函数进阶1
    python_函数初识
    python_文件操作
    python_基础数据类型补充
    python 小数据池,代码块总览
    python_基础数据类型二
    python_基础数据类型一
  • 原文地址:https://www.cnblogs.com/JeasonIsCoding/p/13232607.html
Copyright © 2011-2022 走看看