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
    */

  • 相关阅读:
    浅谈MVP与ModelViewViewModel(MVVM)设计模式
    策略模式
    C#验证码
    如何招到烂程序员
    承载和使用WCF服务
    .NET Remoting 使用总结
    基于.Net Remoting的应用程序
    HTML5 是什么?
    关于HTTP及XMLHTTP状态代码一览
    Remoting多个信道(Chennel)的注册问题
  • 原文地址:https://www.cnblogs.com/JeasonIsCoding/p/13232607.html
Copyright © 2011-2022 走看看