编程软件:IntelliJ IDEA 2018.3 x64
应用环境:JDK1.8
人生名言:每一件事都要用多方面的角度来看它。
技术总结:
adminLTE3.0.5 adminLTE简介https://www.jianshu.com/p/be67f602de66 ##### 1.AdminLTE介绍 AdminLTE是一款建立在bootstrap和jquery之上的开源的模板主题工具,它提供了一系列响应的、 可重复使用的组件,并内置了多个模板页面;同时自适应多种屏幕分辨率,兼容PC和移动端。通 过AdminLTE,我们可以快速的创建一个响应式的Html5网站。AdminLTE框架在网页架构与设计 上,有很大的辅助作用,尤其是前端架构设计师,用好AdminLTE 不但美观,而且可以免去写很大 CSS与JS的工作量。 ##### 2.GitHub获取AdminLTE 从github上获取源码 [https://github.com/ColorlibHQ/AdminLTE](https://links.jianshu.com/go?to=https%3A%2F%2Fgithub.com%2FColorlibHQ%2FAdminLTE) 下载源码 ##### 3.AdminLTE结构介绍 AdminLTE/ ├── dist/ │ ├── CSS/ │ ├── JS │ ├── img ├── build/ │ ├── less/ │ │ ├── AdminLTE's Less files │ └── Bootstrap-less/ (Only for reference. No modifications have been made) │ ├── mixins/ │ ├── variables.less │ ├── mixins.less └── plugins/ ├── All the customized plugins CSS and JS files 框架文件结构 ###### 注意:AdminLTE依赖于两个框架Bootstrap3与JQuery1.11+ ##### 4.AdminLTE布局与皮肤 布局 .wrapper包住了body下的所有代码 .main-header里是网站的logo和导航栏的代码 .main-sidebar里是用户面板和侧边栏菜单的代码 .content-wrapper里是页面的页面和内容区域的代码 .main-footer里是页脚的代码 .control-sidebar里是页面右侧侧边栏区域的代码 布局选项 fixed:固定 layout-boxed:盒子布局 layout-top-nav:顶部隐藏 sidebar-collapse:侧边栏隐藏 sidebar-mini:侧边栏隐藏时有小图标 皮肤 skin-blue:蓝色 skin-black:黑色 skin-purple:紫色 skin-yellow:黄色 skin-red:红色 skin-green:绿色 以上项可以查看start.html页面中查看 # bootstrap ## 简洁、直观、强悍的前端开发框架,让web开发更迅速、简单。 ### 基于hmtl,css,javascript(jquery)的前端移动框架, ### 随着移动互联网的发展,bootstrap3.x开始着重于移动端效果兼容(手机,平板电脑),兼容不同终端(分辨率不一样) # Vue 开发者(初中以前的生活在中国生活,上海人 尤雨溪(男)) ### 制约我的发展的主要原因:穷! # JSP页面不解析EL表达式的原因: ## 是因为:2018.3idea版本中,web.xml中的默认版本在2.4一下 2.3,而jdk使用的jdk1.5, ### 所以只需要将web.xml改成如下写法即可: ## web.xml ``` <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> </web-app> ```
代码展示:
package Servlet; import Pojo.User; import Service.UserService; import Service.UserServiceImp; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; @WebServlet(name = "AddServlet",urlPatterns = {"/AddServlet"}) public class AddServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request,response); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name = request.getParameter("name"); String password = request.getParameter("password"); String email = request.getParameter("email"); String _birthday = request.getParameter("birthday"); Date birthday=null; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { birthday=(Date)sdf.parse(_birthday); } catch (ParseException e) { e.printStackTrace(); } User user = new User(name,password,email,birthday); UserService userService = new UserServiceImp(); boolean b = userService.userAdd(user); if(b){ request.getRequestDispatcher("QueryServlet").forward(request,response); }else{ request.getRequestDispatcher("zhuce.jsp").forward(request,response); } } } package Servlet; import Dao.UserDao; import Pojo.User; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; import java.sql.SQLException; @WebServlet(name = "loginServlet",urlPatterns = {"/loginServlet"}) public class loginServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request,response); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name = request.getParameter("name"); String password = request.getParameter("password"); UserDao userDao = new UserDao(); User user = null; try { user = userDao.loginUser(name, password); } catch (SQLException e) { e.printStackTrace(); } if(user!=null){ HttpSession session = request.getSession(); session.setAttribute("user",user.getName()); request.getRequestDispatcher("QueryServlet").forward(request,response); }else { request.getRequestDispatcher("login.jsp").forward(request,response); } } } package Servlet; import Dao.UserDao; import Pojo.User; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; import java.sql.SQLException; import java.util.ArrayList; @WebServlet(name = "QueryServlet",urlPatterns = {"/QueryServlet"}) public class QueryServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request,response); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { UserDao user = new UserDao(); try { ArrayList<User> list = user.selAllUser(); request.setAttribute("list",list); request.getRequestDispatcher("index.jsp").forward(request,response); } catch (SQLException e) { e.printStackTrace(); } } } <!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous"> <title>login</title> </head> <body> <form action="loginServlet"> <div class="form-group"> <label for="exampleInputEmail1">Email address</label> <input type="email" name="name" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp"> <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small> </div> <div class="form-group"> <label for="exampleInputPassword1">Password</label> <input type="password" name="password" class="form-control" id="exampleInputPassword1"> </div> <div class="form-group form-check"> <input type="checkbox" class="form-check-input" id="exampleCheck1"> <label class="form-check-label" for="exampleCheck1">Check me out</label> </div> <button type="submit" class="btn btn-primary">Submit</button> </form> <!-- Optional JavaScript --> <!-- jQuery first, then Popper.js, then Bootstrap JS --> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script> </body> </html> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous"> <title>分页</title> </head> <body> <h1>欢迎您${user}</h1> <form class="table table-hover" action="zhuce.jsp"> <button>添加</button> </form> <table class="table table-hover"> <thead> <tr> <th scope="col">id</th> <th scope="col">姓名</th> <th scope="col">密码</th> <th scope="col">邮箱</th> <th scope="col">生日</th> </tr> </thead> <c:forEach items="${list}" var="list"> <tbody> <tr> <th scope="row">${list.id}</th> <td>${list.name}</td> <td>${list.password}</td> <td>${list.email}</td> <td>${list.birthday}</td> </tr> </tbody> </c:forEach> </table> <nav aria-label="Page navigation example"> <ul class="pagination justify-content-center"> <li class="page-item disabled"> <a class="page-link" href="#" tabindex="-1" aria-disabled="true">Previous</a> </li> <li class="page-item"><a class="page-link" href="#">1</a></li> <li class="page-item"><a class="page-link" href="#">2</a></li> <li class="page-item"><a class="page-link" href="#">3</a></li> <li class="page-item"> <a class="page-link" href="#">Next</a> </li> </ul> </nav> <!-- Optional JavaScript --> <!-- jQuery first, then Popper.js, then Bootstrap JS --> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script> </body> </html>
心得:
不经历风雨,怎能见彩虹!