BVB Source Codes

The Android source client + server register online booking system Show LoginServlet.java Source code

Return Download The Android source client + server register online booking system: download LoginServlet.java Source code - Download The Android source client + server register online booking system Source code - Type:.java
  1. package com.hospital.servlet;
  2.  
  3. import java.io.IOException;
  4. import java.io.PrintWriter;
  5.  
  6. import javax.servlet.ServletException;
  7. import javax.servlet.http.HttpServlet;
  8. import javax.servlet.http.HttpServletRequest;
  9. import javax.servlet.http.HttpServletResponse;
  10.  
  11. import com.hospital.daoimpl.UserDaoImpl;
  12. import com.hospital.model.User;
  13. import com.hospital.util.GsonUtil;
  14.  
  15. public class LoginServlet extends HttpServlet {
  16.  
  17.         public LoginServlet() {
  18.                 super();
  19.         }
  20.  
  21.         public void destroy() {
  22.                 super.destroy(); // Just puts "destroy" string in log
  23.                 // Put your code here
  24.         }
  25.  
  26.         public void doGet(HttpServletRequest request, HttpServletResponse response)
  27.                         throws ServletException, IOException {
  28.  
  29.         }
  30.  
  31.        
  32.         public void doPost(HttpServletRequest request, HttpServletResponse response)
  33.                         throws ServletException, IOException {
  34.  
  35.                 response.setContentType("text/html;charSet=utf-8");
  36.                 request.setCharacterEncoding("utf-8");
  37.                 PrintWriter out = response.getWriter();
  38.                 UserDaoImpl userDaoImpl = new UserDaoImpl();
  39.                 String userName = (String) request.getParameter("userName");
  40.                 String password = (String) request.getParameter("password");
  41.                 System.out.println(userName);
  42.                 System.out.println(password);
  43.                 User user = userDaoImpl.loginCheck(userName, password);
  44.                 if (user != null){
  45.                         String jsonString = GsonUtil.getGson().toJson(user);
  46.                         out.println(jsonString);
  47.                 }
  48.                 else {
  49.                         out.println("fail");
  50.                 }
  51.  
  52.                 out.flush();
  53.                 out.close();
  54.         }
  55.  
  56.         public void init() throws ServletException {
  57.                 // Put your code here
  58.         }
  59.  
  60. }
  61.  
downloadLoginServlet.java Source code - Download The Android source client + server register online booking system Source code
Related Source Codes/Software:
CoordinatorTabLayout cool components - CoordinatorTabLayout is combination of a custom co... 2017-02-26
grace - Graceful restart & zero downtime deploy for Go... 2017-02-26
tpm - Tmux Plugin Manager 2017-02-26
Win32-OpenSSH - Win32 port of OpenSSH 2017-02-26
goconvey - Go testing in the browser. Integrates with `go tes... 2017-02-26
The Android source gorgeous sunny weather weather forecast program source code - This item is a weather forecast program source cod... 2017-02-26
The Android source of guangdong ocean university library Android client program source code - This project is a guangdong ocean university libra... 2017-02-26
The Android source code imitation sing part layout interface project - This project is a modeled after sing the UI projec... 2017-02-27
The Android source CSDN information client try simple project - This item is a CSDN practice version information o... 2017-02-27
Android jingdong financial front page head effect - Principle is very simple, is through listening Scr... 2017-02-27
flakes - Flakes is an Admin Template Framework. A combinati... 2017-04-15
capstone - Capstone disassembly/disassembler framework: Core ... 2017-04-15
nginx-resources - A collection of resources covering Nginx, Nginx + ... 2017-04-15
utron - A lightweight MVC framework for Go(Golang) 2017-04-15
cfssl - CFSSL: Cloudflare's PKI and TLS toolkit ... 2017-04-15
HandBrake - HandBrake's main development repository ... 2017-04-15
Awesome-Networking - A curated list of awesome networking libraries, re... 2017-04-15
react-sortable-hoc - A set of higher-order components to turn any list ... 2017-04-15
jugglingdb - Multi-database ORM for nodejs: redis, mongodb, mys... 2017-04-15
waybackpack - Download the entire Wayback Machine archive for a ... 2017-04-15

 Back to top