刚刚学习servlet,打算学做一个小项目把前边学到的知识做一个总结.

由于只是实现了一些简单的功能,所以美工就凑合着看吧(美工其实也不太会).

首先项目整体架构如图

项目准备工作:

要用到mysql数据库,所以要导入

直接复制在webroot/web-inf/lib下

然后创建Users库,user表

  1. CREATE DATABASE Users;
  2. USE Users;
  3. CREATE TABLE USER(
  4. id INT PRIMARY KEY AUTO_INCREMENT,//主键
  5. username VARCHAR(32) NOT NULL,//用户名
  6. email VARCHAR(64) NOT NULL,//邮箱
  7. grade INT DEFAULT 1,//级别
  8. PASSWORD VARCHAR(32) NOT NULL//密码
  9.  
  10. );

  事先插入一些用户

  1. INSERT INTO USER(username,email,PASSWORD) VALUES ("mahui","1130804967@sohu.com","123"),
  2. ("aaaa","1130804967@sina.com","123"),
  3. ("bbbb","1130804967@baidu.com","123"),
  4. ("cccc","1130804967@google.com","123"),
  5. ("dddd","1130804967@163.com","123");

1.LoginServlet.java

  1. package com.mh.view;
  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. public class LoginServlet extends HttpServlet {
  12.  
  13. private static final long serialVersionUID = 1L;
  14.  
  15. public void doGet(HttpServletRequest request, HttpServletResponse response)
  16. throws ServletException, IOException {
  17.  
  18. response.setContentType("text/html;charset =UTF-8");
  19. request.setCharacterEncoding("UTF-8");
  20. PrintWriter out = response.getWriter();
  21.  
  22. out.println("<h1>登录界面<h1>");
  23.  
  24. out.println("<form action = '/UsersManager/LoginClServlet' method = 'post'>");//form表单提交到LoginClServlet.java
  25. out.println("I D:<input type = 'text' name = 'id'/><br/>");
  26. out.println("密 码:<input type = 'password' name = 'password'/><br/>");
  27. out.println("<input type = 'submit' value = 'Submit'/>");
  28. out.println("</form>");
  29. String errInfo =(String)request.getAttribute("err");//第一次该属性为null,什么都不显示
  30. if(errInfo != null){
  31. out.println("<font color = 'red'>"+errInfo+"<font>");//如果errinfo不为空,则输出错误信息
  32. }
  33.  
  34. }
  35.  
  36. public void doPost(HttpServletRequest request, HttpServletResponse response)
  37. throws ServletException, IOException {
  38.  
  39. }
  40.  
  41. }

2.LoginClServlet.java(该servlet用于简易的处理用户登录信息)

  1. package com.mh.controller;
  2.  
  3. import java.io.IOException;
  4. import java.sql.Connection;
  5. import java.sql.DriverManager;
  6. import java.sql.PreparedStatement;
  7. import java.sql.ResultSet;
  8. import java.sql.SQLException;
  9.  
  10. import javax.servlet.ServletException;
  11. import javax.servlet.http.HttpServlet;
  12. import javax.servlet.http.HttpServletRequest;
  13. import javax.servlet.http.HttpServletResponse;
  14.  
  15. public class LoginClServlet extends HttpServlet {
  16.  
  17. private static final long serialVersionUID = 1L;
  18.  
  19. public final static String URL = "jdbc:mysql://localhost:3306/Users";//建立连接
  20.  
  21. public final static String USER = "root";//用户
  22.  
  23. public final static String PASSWORD = "334400";//密码
  24.  
  25. public void doGet(HttpServletRequest request, HttpServletResponse response)
  26. throws ServletException, IOException {
  27. request.setCharacterEncoding("UTF-8");
  28.  
  29. String id = request.getParameter("id");//获取id
  30. String pass = request.getParameter("password");//获取密码
  31.  
  32. Connection conn = null;
  33. PreparedStatement prep = null;
  34. ResultSet set = null;
  35. try{
  36. Class.forName("com.mysql.jdbc.Driver");//加载驱动
  37.  
  38. conn = DriverManager.getConnection(URL,USER,PASSWORD);//获得与数据库的连接对象conn
  39.  
  40. prep = conn.prepareStatement("select * from User where id = ? and password = ?");//预处理语句
  41.  
  42. prep.setString(1,id);//第一个?赋值
  43. prep.setString(2,pass);//第二个?赋值
  44.  
  45. set = prep.executeQuery();//执行查询
  46.  
  47. if(set.next()){//如果结果集合存在用户
  48. request.getRequestDispatcher("/MainFrame").forward(request,response);//转发到/MainFrame主页面
  49. }else{
  50. request.setAttribute("err", "用户ID或密码有误!");//如果不存在该用户,则设置err属性的信息
  51. request.getRequestDispatcher("/LoginServlet").forward(request, response);//转发到登录界面
  52. }
  53.  
  54. }catch(Exception e){
  55. e.printStackTrace();
  56. }finally{
  57. //以下为关闭资源
  58. if(set != null){
  59. try {
  60. set.close();
  61. } catch (SQLException e) {
  62. e.printStackTrace();
  63. }
  64. }
  65. if(prep != null){
  66. try {
  67. prep.close();
  68. } catch (SQLException e) {
  69. e.printStackTrace();
  70. }
  71. }
  72. if(conn != null){
  73. try {
  74. conn.close();
  75. } catch (SQLException e) {
  76. e.printStackTrace();
  77. }
  78. }
  79. }
  80.  
  81. }
  82.  
  83. public void doPost(HttpServletRequest request, HttpServletResponse response)
  84. throws ServletException, IOException {
  85.  
  86. doGet(request,response);
  87. }
  88.  
  89. }

3.MainFrame.java

  1. package com.mh.view;
  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. public class MainFrame extends HttpServlet {
  12.  
  13. private static final long serialVersionUID = 1L;
  14.  
  15. public void doGet(HttpServletRequest request, HttpServletResponse response)
  16. throws ServletException, IOException {
  17.  
  18. response.setContentType("text/html;charset=UTF-8");
  19. request.setCharacterEncoding("utf-8");
  20. PrintWriter out = response.getWriter();
  21. //这里没什么好讲的,都是一些链接
  22. out.println("<h1>登陆成功<h1>");
  23. out.println("<h3>请选择一下操作<h3>");
  24. out.println("<a href = '/UsersManager/ManageUsers'>管理用户</a>");//跳转到管理界面
  25. out.println("<a href = '/UsersManager/AddUserMain'>添加用户</a>");//添加用户
  26. out.println("<a href = '/UsersManager/SelectUsers'>查询用户</a>");//查询
  27. out.println("<a href = '/UsersManager/LoginServlet'>安全退出</a>");//退出
  28.  
  29. }
  30.  
  31. public void doPost(HttpServletRequest request, HttpServletResponse response)
  32. throws ServletException, IOException {
  33. doGet(request,response);
  34.  
  35. }
  36.  
  37. }

  4.跳转到管理用户页面,这里边是逻辑比较复杂的一个页面,因为页面和逻辑没有实现分离,还有里边使用了分页,mysql的分页是依靠limit来实现

  1. package com.mh.view;
  2.  
  3. import java.io.IOException;
  4. import java.io.PrintWriter;
  5. import java.sql.Connection;
  6. import java.sql.DriverManager;
  7. import java.sql.PreparedStatement;
  8. import java.sql.ResultSet;
  9. import java.sql.SQLException;
  10.  
  11. import javax.servlet.ServletException;
  12. import javax.servlet.http.HttpServlet;
  13. import javax.servlet.http.HttpServletRequest;
  14. import javax.servlet.http.HttpServletResponse;
  15.  
  16. public class ManageUsers extends HttpServlet {
  17.  
  18. private static final long serialVersionUID = 1L;
  19.  
  20. public final static String URL = "jdbc:mysql://localhost:3306/Users";
  21.  
  22. public final static String USER = "root";
  23.  
  24. public final static String PASSWORD = "334400";
  25.  
  26. public void doGet(HttpServletRequest request, HttpServletResponse response)
  27. throws ServletException, IOException {
  28.  
  29. response.setContentType("text/html;charset=utf-8");
  30. PrintWriter out = response.getWriter();
  31. //以下四行代码实现了跳转功能,document.getElementById('pageNow')首先获得你要跳转的页面,然后在本页面(_self参数控制)打开一个新的页面,并把page当成参数传给本页面
  32. out.print("<script type = 'text/javascript' language = 'javascript'>");
  33. out.print("function go(){var page = document.getElementById('pageNow');"
  34. + "window.open('/UsersManager/ManageUsers?page='+page.value,'_self');}");
  35. out.print("</script>");
  36.  
  37. out.println("<h1>用户管理</h1><a href = '/UsersManager/MainFrame'>主页面</a><hr/>");
  38.  
  39. out.println("<table border = 1 width = 500px>");
  40.  
  41. out.println("<tr><th>ID</th><th>用户名</th><th>Email</th><th>级别</th></tr>");
  42.  
  43. Connection conn = null;
  44. PreparedStatement prep = null;
  45. ResultSet set = null;
  46. try{
  47. Class.forName("com.mysql.jdbc.Driver");
  48.  
  49. conn = DriverManager.getConnection(URL,USER,PASSWORD);
  50.  
  51. prep = conn.prepareStatement("select count(id) from User ");//获得总共有多少条记录,为分页做准备
  52.  
  53. set = prep.executeQuery();
  54.  
  55. set.next();//这里要注意,因为光标是指向集合第一条记录的前面,所以要执行next()方法
  56. int rowCount = set.getInt(1);//把总数赋值给rowcount
  57.  
  58. int pageSize = 3;//每页显示几条记录
  59.  
  60. int pageCount = (rowCount-1)/pageSize + 1;//总共有几页(这里用到了一个小算法)
  61.  
  62. int pageCurr = 1;//当前页
  63.  
  64. String curr_Page = (String) request.getParameter("page");//这里是为了获取用户点击下边的第i页跳转到本页面提交的page参数
  65.  
  66. if(curr_Page != null){
  67. pageCurr = Integer.parseInt(curr_Page);//第一次该参数为null,以后根据用户点击的页数而定
  68. }
  69.  
  70. prep.close();//先关闭
  71. set.close();
  72.  
  73. String sql = "select * from User limit "+(pageCurr-1)*pageSize+ ","+pageSize;//这里分页用到了limit,使用limit (第几页-1)*每页显示的记录,每页显示记录数
  74. prep = conn.prepareStatement(sql);//再次预处理新的sql
  75.  
  76. set = prep.executeQuery();//执行
  77.  
  78. while(set.next()){//这里得到的set结果集是一个集合,所以使用while循环
  79. out.println("<tr><td>"+set.getInt(1)+"</td><td>"
  80. +set.getString(2)+"</td><td>"+set.getString(3)
  81. +"</td><td>"+set.getString(4)+"</td></tr>");
  82. }
  83. out.println("</table><br/>");
  84. if(pageCurr != 1){
  85. out.print("<a href = '/UsersManager/ManageUsers?page="+(pageCurr-1)+"'>上一页 </a>");
  86. }
  87. //这里是表格的下边把总页数以for循环的方式创建超链接
  88. for(int i = 1; i <= pageCount; i++){////如果不等于第一页,则显示,否则隐藏
  89. out.print("<a href = '/UsersManager/ManageUsers?page="+i+"'><"+i+"></a>");
  90. }
  91. if(pageCurr != pageCount){//如果不等于最后一页,则显示,否则隐藏
  92. out.print("<a href = '/UsersManager/ManageUsers?page="+(pageCurr+1)+"'>下一页 </a>");
  93. }
  94.  
  95. out.print("当前页"+pageCurr+"/总页数"+pageCount);
  96. //下边是一个跳转功能,要用到javascript,给按钮增加一个点击事件,一点击该按钮,则调用go()方法,该方法在代码的头部
  97. out.print("<br/>跳转到");
  98. out.print("<input type = 'text' size = '20px' id = 'pageNow'/>");
  99. out.print("&nbsp;&nbsp;<input type = 'button' value = 'GO' onclick = 'go()'/>");
  100. }catch(Exception e){
  101. e.printStackTrace();
  102. }finally{
  103. //关闭资源
  104. if(set != null){
  105. try {
  106. set.close();
  107. } catch (SQLException e) {
  108. e.printStackTrace();
  109. }
  110. }
  111. if(prep != null){
  112. try {
  113. prep.close();
  114. } catch (SQLException e) {
  115. e.printStackTrace();
  116. }
  117. }
  118. if(conn != null){
  119. try {
  120. conn.close();
  121. } catch (SQLException e) {
  122. e.printStackTrace();
  123. }
  124. }
  125. }
  126. }
  127.  
  128. public void doPost(HttpServletRequest request, HttpServletResponse response)
  129. throws ServletException, IOException {
  130. doGet(request,response);
  131.  
  132. }
  133.  
  134. }

5.AddUserMain.java 没什么好说的

  1. package com.mh.view;
  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. public class AddUserMain extends HttpServlet {
  12.  
  13. private static final long serialVersionUID = 1L;
  14.  
  15. public void doGet(HttpServletRequest request, HttpServletResponse response)
  16. throws ServletException, IOException {
  17. response.setContentType("text/html;charset=utf-8");
  18. PrintWriter out = response.getWriter();
  19.  
  20. out.print("<h1>添加用户</h1><br/><hr/>");
  21. out.print("<form action = '/UsersManager/AddUserHandle' method = 'post'>Name:<input type = 'text' name = 'name'/><br/>");
  22. out.print("Email:<input type = 'text' name = 'email'/><br/>");
  23. out.print("PassWord:<input type = 'password' name = 'password'/><br/>");
  24. out.print("<input type = 'submit' value = 'Submit'/>");
  25.  
  26. out.print("</form>");
  27.  
  28. }
  29.  
  30. public void doPost(HttpServletRequest request, HttpServletResponse response)
  31. throws ServletException, IOException {
  32.  
  33. doGet(request,response);
  34. }
  35.  
  36. }

6.AddUserHandle.java

  1. package com.mh.controller;
  2.  
  3. import java.io.IOException;
  4. import java.sql.Connection;
  5. import java.sql.DriverManager;
  6. import java.sql.PreparedStatement;
  7. import java.sql.ResultSet;
  8. import java.sql.SQLException;
  9.  
  10. import javax.servlet.ServletException;
  11. import javax.servlet.http.HttpServlet;
  12. import javax.servlet.http.HttpServletRequest;
  13. import javax.servlet.http.HttpServletResponse;
  14.  
  15. public class AddUserHandle extends HttpServlet {
  16.  
  17. private static final long serialVersionUID = 1L;
  18.  
  19. public final static String URL = "jdbc:mysql://localhost:3306/Users";
  20.  
  21. public final static String USER = "root";
  22.  
  23. public final static String PASSWORD = "334400";
  24.  
  25. public void doGet(HttpServletRequest request, HttpServletResponse response)
  26. throws ServletException, IOException {
  27.  
  28. response.setContentType("text/html;charset=utf-8");
  29.  
  30. String username = new String(request.getParameter("name").getBytes("ISO-8859-1"),"UTF-8") ;//获取用户名,这样写是为了用户输入的中文乱码
  31. String email = request.getParameter("email");//获取邮箱
  32. String password = request.getParameter("password");//获取密码
  33.  
  34. int row = 0;
  35. Connection conn = null;
  36. PreparedStatement prep = null;
  37. ResultSet set = null;
  38. try{
  39. Class.forName("com.mysql.jdbc.Driver");
  40.  
  41. conn = DriverManager.getConnection(URL,USER,PASSWORD);
  42.  
  43. prep = conn.prepareStatement("insert into User (username,email,password)values(?,?,?)");//预处理
  44.  
  45. prep.setString(1,username);//赋值
  46. prep.setString(2,email);
  47. prep.setString(3, password);
  48.  
  49. row = prep.executeUpdate();//执行更新,返回一个整数
  50.  
  51. if(row != 0){//插入成功返回到ManageUsers.java
  52. request.getRequestDispatcher("/ManageUsers").forward(request,response);
  53. }else{
  54. //录入失败返回本界面
  55. request.getRequestDispatcher("/AddUserMain").forward(request, response);
  56. }
  57.  
  58. }catch(Exception e){
  59. e.printStackTrace();
  60. }finally{
  61. //关闭资源
  62. if(set != null){
  63. try {
  64. set.close();
  65. } catch (SQLException e) {
  66. e.printStackTrace();
  67. }
  68. }
  69. if(prep != null){
  70. try {
  71. prep.close();
  72. } catch (SQLException e) {
  73. e.printStackTrace();
  74. }
  75. }
  76. if(conn != null){
  77. try {
  78. conn.close();
  79. } catch (SQLException e) {
  80. e.printStackTrace();
  81. }
  82. }
  83. }
  84.  
  85. }
  86.  
  87. public void doPost(HttpServletRequest request, HttpServletResponse response)
  88. throws ServletException, IOException {
  89.  
  90. doGet(request,response);
  91. }
  92.  
  93. }

7.SelectUsers.java

  1. package com.mh.view;
  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. public class SelectUsers extends HttpServlet {
  12.  
  13. private static final long serialVersionUID = 1L;
  14.  
  15. public void doGet(HttpServletRequest request, HttpServletResponse response)
  16. throws ServletException, IOException {
  17.  
  18. response.setContentType("text/html;charset=utf-8");
  19. PrintWriter out = response.getWriter();
  20. out.print("<h1>查找用户</h1><br/><hr/>");
  21. out.print("&nbsp;&nbsp;&nbsp;&nbsp;<a href = '/UsersManager/MainFrame'>主页面</a>");
  22. out.print("<form action = '/UsersManager/SelectHandle' method = 'post'>");//跳转到SelectHandle.java
  23. out.print("请输入关键字&nbsp;&nbsp;<input type = 'text' size = '10px' name = 'key'/>");
  24. out.print("&nbsp;&nbsp;<input type = 'submit' value = '查找'/>");
  25. out.print("</form>");
  26. }
  27.  
  28. public void doPost(HttpServletRequest request, HttpServletResponse response)
  29. throws ServletException, IOException {
  30.  
  31. doGet(request,response);
  32. }
  33.  
  34. }

8.SelectHandle.java

  1. package com.mh.controller;
  2.  
  3. import java.io.IOException;
  4. import java.io.PrintWriter;
  5. import java.sql.Connection;
  6. import java.sql.DriverManager;
  7. import java.sql.PreparedStatement;
  8. import java.sql.ResultSet;
  9. import java.sql.SQLException;
  10.  
  11. import javax.servlet.ServletException;
  12. import javax.servlet.http.HttpServlet;
  13. import javax.servlet.http.HttpServletRequest;
  14. import javax.servlet.http.HttpServletResponse;
  15.  
  16. public class SelectHandle extends HttpServlet {
  17.  
  18. private static final long serialVersionUID = 1L;
  19.  
  20. public final static String URL = "jdbc:mysql://localhost:3306/Users";
  21.  
  22. public final static String USER = "root";
  23.  
  24. public final static String PASSWORD = "334400";
  25.  
  26. public void doGet(HttpServletRequest request, HttpServletResponse response)
  27. throws ServletException, IOException {
  28.  
  29. response.setContentType("text/html;charset=utf-8");
  30.  
  31. PrintWriter out = response.getWriter();
  32.  
  33. String key = new String(request.getParameter("key").getBytes("ISO-8859-1"),"UTF-8") ;
  34.  
  35. Connection conn = null;
  36. PreparedStatement prep = null;
  37. ResultSet set = null;
  38. try{
  39. Class.forName("com.mysql.jdbc.Driver");
  40.  
  41. conn = DriverManager.getConnection(URL,USER,PASSWORD);
  42.  
  43. prep = conn.prepareStatement("select * from User where username like ?");//模糊查询username
  44.  
  45. prep.setString(1,"%"+key+"%");//模糊查询格式
  46. set = prep.executeQuery();
  47. out.print("<h1>查询结果</h1><br/><hr/>");
  48. out.print("&nbsp;&nbsp;&nbsp;&nbsp;<a href = '/UsersManager/SelectUsers'>返回</a>");
  49. out.println("<table border = 1 width = 500px>");
  50.  
  51. out.println("<tr><th>ID</th><th>用户名</th><th>Email</th><th>级别</th></tr>");
  52.  
  53. while(set.next()){//返回集合,遍历
  54. out.println("<tr><td>"+set.getInt(1)+"</td><td>"
  55. +set.getString(2)+"</td><td>"+set.getString(3)
  56. +"</td><td>"+set.getString(4)+"</td></tr>");
  57. }
  58. out.println("</table><br/>");
  59.  
  60. }catch(Exception e){
  61. e.printStackTrace();
  62. }finally{
  63. if(set != null){
  64. try {
  65. set.close();
  66. } catch (SQLException e) {
  67. e.printStackTrace();
  68. }
  69. }
  70. if(prep != null){
  71. try {
  72. prep.close();
  73. } catch (SQLException e) {
  74. e.printStackTrace();
  75. }
  76. }
  77. if(conn != null){
  78. try {
  79. conn.close();
  80. } catch (SQLException e) {
  81. e.printStackTrace();
  82. }
  83. }
  84. }
  85.  
  86. }
  87.  
  88. public void doPost(HttpServletRequest request, HttpServletResponse response)
  89. throws ServletException, IOException {
  90.  
  91. doGet(request,response);
  92. }
  93.  
  94. }

UserManager的更多相关文章

  1. CoreCRM 开发实录 —— 单元测试之 Mock UserManager 和 SignInManager

    单元测试的核心就是:只测试眼前的逻辑.这就要求所有的依赖项都要使用仿类来代替,也就是所谓的 Mock Object.在测试 ProfileRepository 和 AccountController ...

  2. 解决EJB本地调用“java.lang.ClassCastException: $Proxy96 cannot be cast to com.tgb.ejb.UserManager”异常

    EJB本地调用方式:把Webclient和EJB服务端部署到同一个JBoss,client和server通过一个JVM进行通信. Web客户端本地调用时.需引用EJB服务端打包的jar,不需引用JBo ...

  3. InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Identity.UserManager`1[Microsoft.AspNetCore.Identity.IdentityUser]'

    在新建asp.net core 应用后, 添加了自定义的ApplicationDbContext 和ApplicationUser ,并添加了Identity认证后, 会出现 InvalidOpera ...

  4. win10系统中UserManager 总是被禁用怎么解决?

    RT,也就是提示win10开始菜单和cortana无法工作.升级win10后一直被这个问题困扰,论坛也见有人发帖求助这类问题,百度了方法打开任务管理器进入服务更改User Manager启动类型为自动 ...

  5. .NET Core中的认证管理解析

    .NET Core中的认证管理解析 0x00 问题来源 在新建.NET Core的Web项目时选择“使用个人用户账户”就可以创建一个带有用户和权限管理的项目,已经准备好了用户注册.登录等很多页面,也可 ...

  6. ASP.NET Core 之 Identity 入门(三)

    前言 在上一篇文章中,我们学习了 CookieAuthentication 中间件,本篇的话主要看一下 Identity 本身. 最早2005年 ASP.NET 2.0 的时候开始, Web 应用程序 ...

  7. 从Membership 到 .NET4.5 之 ASP.NET Identity

    我们前面已经讨论过了如何在一个网站中集成最基本的Membership功能,然后深入学习了Membership的架构设计.正所谓从实践从来,到实践从去,在我们把Membership的结构吃透之后,我们要 ...

  8. 年度巨献-WPF项目开发过程中WPF小知识点汇总(原创+摘抄)

    WPF中Style的使用 Styel在英文中解释为”样式“,在Web开发中,css为层叠样式表,自从.net3.0推出WPF以来,WPF也有样式一说,通过设置样式,使其WPF控件外观更加美化同时减少了 ...

  9. [Android]使用Dagger 2来构建UserScope(翻译)

    以下内容为原创,欢迎转载,转载请注明 来自天天博客:http://www.cnblogs.com/tiantianbyconan/p/6237731.html 使用Dagger 2来构建UserSco ...

随机推荐

  1. 梳理下Cordova的热更新

    公司的大部分都是Hybrid 产品,也就是混合开发,所以比较重要的一个核心功能就是热更新了. 做这个功能的时候中间碰到不少坑,记录一下,比较简单,大致思想就是从服务器拉取JS文件替换掉本地对应文件 之 ...

  2. shiro权限控制

    1.1  简介 Apache Shiro是Java的一个安全框架.目前,使用Apache Shiro的人越来越多,因为它相当简单,对比Spring Security,可能没有Spring Securi ...

  3. Docker(开课吧笔记)

    1.Docker基本概念 Docker运行在Linux,需要git技能 docker官网解析   来源于容器又不仅仅是容器,第一个版本基于LXC,远远超过容器概念   交付时拿到的是镜像,直接run运 ...

  4. 使用Python对Access读写操作

    学习Python的过程中,我们会遇到Access的读写问题,这时我们可以利用win32.client模块的COM组件访问功能,通过ADODB操作Access的文件. 1.导入模块 import win ...

  5. 6.Java集合总结系列:常见集合类的使用(List/Set/Map)

    MARK 总结: Set.List 和 Map 可以看做集合的三大类. List集合是有序集合,集合中的元素可以重复,访问集合中的元素可以根据元素的索引来访问. Set集合是无序集合,集合中的元素不可 ...

  6. word-wrap: break-word;与word-break: break-all;文本自动换行

    word-break:break-all和word-wrap:break-word都是能使其容器如DIV的内容自动换行它们的区别就在于:1,word-break:break-all 例如div宽200 ...

  7. sublimeText3插件安装

    1,官方下载sublimeText 3(百度搜索) 2,安装成功后按Ctrl+`调出console 3,然后输入 import urllib.request,os; pf = 'Package Con ...

  8. Yum -userguide

    Introduction Yum(Yellow dog Updater, Modified) is an automatic updater and package installer/remover ...

  9. Nest客户端的基本使用方法

    通过Nuget安装好Nest的相关Dll,之后我们就可以开始了, 1.初始化Nest客户端 string indexName = "customer"; Uri uri = new ...

  10. 关于sql、mysql语句的模糊查询分类与详解,包括基本用法和mapper.xml文件里插入写法

    欢迎猿类加qq:2318645572,共同学习进步 实际例子: ssm框架:service业务层->dao层->mappers.xml->junit/test测试 1:service ...