SQL前后端分页
/class Page<T>
package com.neusoft.bean; import java.util.List; public class Page<T> {
private List<T> data; //后台数据库查询出来
private int totalRecord; //表示总共有多少记录,从数据库中查询出来 // private int totalPage; // 表示总共有多少页,计算得到!
// private int index; //表示当前索引值,计算出来的! private int pageNumber; //表示的是当前页码,这个参数是从页面传递过来的!
private int pageSize; //表示的是每页显示多少条数据 ,在servlet中设置的!
private String path; public Page() {
super();
} public Page(int totalRecord, int pageNumber, int pageSize) {
super();
this.totalRecord = totalRecord;
this.pageNumber = pageNumber;
this.pageSize = pageSize;
} public String getPath() {
return path;
} public void setPath(String path) {
this.path = path;
} public List<T> getData() {
return data;
} public void setData(List<T> data) {
this.data = data;
} public int getTotalRecord() {
return totalRecord;
} public void setTotalRecord(int totalRecord) {
this.totalRecord = totalRecord;
} public int getTotalPage() {
/**
* totalPage:表示总共有几页!
*
* 总页数 totalRecord[总记录数] pageSize
* 5 10 2
* 5 9 2
* 4 8 2
*/
if(totalRecord % pageSize ==0){
return totalRecord / pageSize;
} return (totalRecord / pageSize + 1);
} public int getIndex() {
/**
* index表示的是当前索引值,是计算得到的!
* 当前索引值 每页显示几条数据 当前页是第几页
* 0 3 1
* 3 3 2
*
index = (pageNumber -1)*pageSize;
*/
return (getPageNumber() -1)*pageSize;
} public int getPageNumber() {
if(pageNumber < 1){
return 1;
}else if(pageNumber > getTotalPage()){
return getTotalPage();
}
return pageNumber;
} public int getPageSize() {
return pageSize;
} public void setPageSize(int pageSize) {
this.pageSize = pageSize;
} }
/class Student
package com.neusoft.bean; public class Student {
private int id;
private String name;
private String school;
private String score;
public Student() {
super();
// TODO Auto-generated constructor stub
}
public Student(int id, String name, String school, String score) {
super();
this.id = id;
this.name = name;
this.school = school;
this.score = score;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSchool() {
return school;
}
public void setSchool(String school) {
this.school = school;
}
public String getScore() {
return score;
}
public void setScore(String score) {
this.score = score;
}
@Override
public String toString() {
return "Student [id=" + id + ", name=" + name + ", school=" + school + ", score=" + score + "]";
} }
/class StudentDao
package com.neusoft.dao; import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List; import com.neusoft.bean.Student;
import com.neusoft.utils.JDBCUtil; public class StudentDao {
public List<Student> getStudentList(){
PreparedStatement ps=null;
ResultSet rs =null;
List<Student> list=new ArrayList<Student>();
Connection conn=JDBCUtil.getConnection();
String sql="select * from student";
try {
ps = conn.prepareStatement(sql); rs = ps.executeQuery();
while (rs.next()) {
Student stu=new Student();
int id = rs.getInt("id");
String username = rs.getString("name");
String school = rs.getString("school");
String score = rs.getString("score");
stu.setId(id);
stu.setName(username);
stu.setSchool(school);
stu.setScore(score);
list.add(stu);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
JDBCUtil.close(ps, rs, conn);
}
return list; }
public static int delete(int id){
return JDBCUtil.executeUpdate("delete from student where id=?",id); }
public int update(Student student){
return JDBCUtil.executeUpdate("update student set name=?,school=?,score=? where id=?",student.getName(),student.getSchool(),student.getScore(),student.getId());
} public int add(Student student){
return JDBCUtil.executeUpdate("insert into student (id,name,school,score) values (?,?,?,?)",null,student.getName(),student.getSchool(),student.getScore());
}
public List<Student> getStudent(Student student){
PreparedStatement ps=null;
ResultSet rs =null;
List<Student> list=new ArrayList<Student>();
Connection conn=JDBCUtil.getConnection();
String sql="select * from student where name= '"+student.getName()+"'";
try {
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
while (rs.next()) {
Student stu=new Student();
int id = rs.getInt("id");
String username = rs.getString("name");
String school = rs.getString("school");
String score = rs.getString("score");
stu.setId(id);
stu.setName(username);
stu.setSchool(school);
stu.setScore(score);
list.add(stu);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
JDBCUtil.close(ps, rs, conn);
}
return list; }
public Student getStuInfoById(String id) {
PreparedStatement ps=null;
ResultSet rs =null;
Student stu=null;
List<Student> list=new ArrayList<Student>();
Connection conn=JDBCUtil.getConnection();
String sql="select * from student where id = ?";
try {
ps = conn.prepareStatement(sql);
ps.setInt(1, Integer.parseInt(id));
rs = ps.executeQuery();
while (rs.next()) {
stu=new Student();
String username = rs.getString("name");
String school = rs.getString("school");
String score = rs.getString("score");
stu.setId(Integer.parseInt(id));
stu.setName(username);
stu.setSchool(school);
stu.setScore(score);
list.add(stu);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
JDBCUtil.close(ps, rs, conn);
}
return stu;
}
public int getTotalRecord() {
PreparedStatement ps=null;
ResultSet rs =null;
Connection conn=JDBCUtil.getConnection();
String sql="select count(*) as total from student ";
int total=0;
try {
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
while (rs.next()) {
total= rs.getInt("total");
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
JDBCUtil.close(ps, rs, conn);
}
return total;
}
public List<Student> getLimitStuList(int index, int pageSize) {
PreparedStatement ps=null;
ResultSet rs =null;
Connection conn=JDBCUtil.getConnection();
String sql="select * from student limit ? , ?";
List<Student> list= new ArrayList<Student>();
try {
ps = conn.prepareStatement(sql);
ps.setInt(1, index);
ps.setInt(2, pageSize);
rs = ps.executeQuery();
while (rs.next()) {
int id=rs.getInt("id");
String name = rs.getString("name");
String school = rs.getString("school");
String score = rs.getString("score");
list.add(new Student(id,name,school,score));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
JDBCUtil.close(ps, rs, conn);
}
return list;
}
}
/class StudentService
package com.neusoft.service; import java.util.List; import com.neusoft.bean.Page;
import com.neusoft.bean.Student;
import com.neusoft.dao.StudentDao; public class StudentService {
private StudentDao stuDao=new StudentDao();
public Page<Student> getStudentList(int pageNo, int pageSize){
//第一步:查询当前表的所有记录数
int totalRecord= stuDao.getTotalRecord();
//第二步:创建page对象
Page<Student> page = new Page<Student>(totalRecord,pageNo,pageSize);
//第三步:查询分页列表数据并设置到page对象中!
List<Student> list = stuDao.getLimitStuList(page.getIndex(),page.getPageSize());
page.setData(list); return page;
}
public List<Student> getStudent(Student student){
return stuDao.getStudent(student);
}
public Student getStuInfoById(String id) {
// TODO Auto-generated method stub
return stuDao.getStuInfoById(id);
}
public int Add(Student student){
return stuDao.add(student);
}
public int Update(Student student){
return stuDao.update(student);
}
}
/class BaseServlet
package com.neusoft.servlet; import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; 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 BaseServlet
*/
@WebServlet("/BaseServlet")
public class BaseServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected static int pageSize=1;
protected static int pageNo=1; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf8");
try {
pageNo =Integer.parseInt(request.getParameter("pageNo"));
} catch (Exception e) {
e.getMessage();
} //获取用户传递的请求参数
String methodName = request.getParameter("method");
//通过方法名获取到方法的对象
//获取当前类的Class对象
Class<? extends BaseServlet> cla = this.getClass();
//获取cla的的方法(Method对象)
//getDeclaredMethod需要两个参数,方法名和参数名
//因为在java需要通过方法名和参数列表来确定一个方法
try {
//获取方法对象
Method method = cla.getDeclaredMethod(methodName, HttpServletRequest.class , HttpServletResponse.class);
//设置方法的访问权限
method.setAccessible(true);
//调用方法
//invoke用于调用一个方法,第一个参数时要调用方法的对象,剩下是调用方法需要的参数
method.invoke(this, request , response);
}catch (InvocationTargetException e) {
System.out.println("此处接收被调用方法内部未被捕获的异常");
e.getMessage();
}catch (Exception e) {
e.printStackTrace();
}
} protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf8");
doGet(request, response); } }
/class StudentServlet
package com.neusoft.servlet; import java.io.IOException;
import java.util.List; import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import com.neusoft.bean.Page;
import com.neusoft.bean.Student;
import com.neusoft.dao.StudentDao;
import com.neusoft.service.StudentService;
import com.neusoft.utils.WEBUtils; @WebServlet("/StudentServlet")
public class StudentServlet extends BaseServlet {
private static final long serialVersionUID = 1L;
private StudentService stuService=new StudentService(); protected void getStuList(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String url = WEBUtils.getPath(request);
Page<Student> page = stuService.getStudentList(pageNo,pageSize);
page.setPath(url);
request.setAttribute("page",page);
request.getRequestDispatcher("/WEB-INF/view/main.jsp").forward(request, response);
}
protected void toUpdatePage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("id");
Student stu= stuService.getStuInfoById(id);
if (stu != null) {
request.setAttribute("stu",stu);
request.getRequestDispatcher("/WEB-INF/view/update.jsp").forward(request, response);
} }
protected void Delete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String ids = request.getParameter("id");
int id=Integer.parseInt(ids);
StudentDao.delete(id);
getStuList(request, response);
//request.getRequestDispatcher("/WEB-INF/view/main.jsp").forward(request, response);
}
protected void Update(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf8");
String name = request.getParameter("name");
String school = request.getParameter("school");
String score = request.getParameter("score");
int id=Integer.parseInt(request.getParameter("id"));
Student student=new Student();
student.setName(name);
student.setSchool(school);
student.setScore(score);
student.setId(id);
System.out.println(name);
stuService.Update(student);
// response.sendRedirect("/Regist-success.html");//重定向
getStuList(request, response); }
protected void Add(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf8");
String name = request.getParameter("name");
String school = request.getParameter("school");
String score = request.getParameter("score");
Student student=new Student();
student.setName(name);
student.setSchool(school);
student.setScore(score);
List<Student> student2 = stuService.getStudent(student);
System.out.println(student2.toString());
if (student2.isEmpty()) {
stuService.Add(student);
getStuList(request, response); }else {
// response.sendRedirect("/Regist-success.html");//重定向
request.getRequestDispatcher("/WEB-INF/view/insert-error.jsp").forward(request, response);//转发
}
} }
/class TOInsert
package com.neusoft.servlet; 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 TOInsert
*/
@WebServlet("/TOInsert")
public class TOInsert extends HttpServlet {
private static final long serialVersionUID = 1L; /**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.getRequestDispatcher("/WEB-INF/view/insert.jsp").forward(request, response); } /**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
request.setCharacterEncoding("utf8");
} }
/ class JDBCUtil
package com.neusoft.utils; import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement; public class JDBCUtil {
private static String driver="com.mysql.jdbc.Driver";
private static String url="jdbc:mysql://localhost:3306/demo";
private static String username="root";
private static String password="123456";
static{ try {//加载驱动
Class.forName(driver);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} }
public static Connection getConnection(){//创建连接
try {
return DriverManager.getConnection(url, username, password);
} catch (SQLException e) {
// TODO Auto-generated catch block
return null;
}
} public static void close(Statement st,ResultSet rs,Connection conn){//全部关闭
if (conn !=null) {
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (rs !=null) {
try {
rs.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (st !=null) {
try {
st.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public static void close(Connection conn){
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} }
public static void close(PreparedStatement ps){
try {
ps.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} }
public static void close(ResultSet rs){
try {
rs.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} } //封装函数,直接传参使用
public static int executeUpdate(String sql,Object... papram) {
// TODO Auto-generated method stub
Connection conn =getConnection();
int result=0;
try {
PreparedStatement pst = conn.prepareStatement(sql);
if (papram!=null) {
for (int i = 0; i < papram.length; i++) {
pst.setObject(i+1, papram[i]);
}
}
result =pst.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
close(conn);
}
return result; }
}
/class WEBUtils
package com.neusoft.utils; import javax.servlet.http.HttpServletRequest; public class WEBUtils {
public static String getPath(HttpServletRequest request){
String requestURI = request.getRequestURI();
String queryString = request.getQueryString();
String url = requestURI+"?"+queryString;
if(url.contains("&pageNo")){
url = url.substring(0, url.indexOf("&pageNo"));
}
if(url.contains("Update")){
url = url.replace("Update", "getStuList");
}
if(url.contains("Add")){
url = url.replace("Add", "getStuList");
}
if(url.contains("Delete")){
url = url.replace("Delete", "getStuList");
}
return url;
}
}
index.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<a href="${pageContext.request.contextPath}/StudentServlet?method=getStuList&pageNo=1">go!</a>
</body>
</html>
main.jsp
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
</head>
<body> <table border="" align="center" width="50%">
<tr>
<th>姓名</th>
<th>学校</th>
<th>成绩</th>
<th colspan="">操作</th>
</tr>
<c:forEach items="${page.data}" var="stu">
<tr>
<td>${stu.name}</td>
<td>${stu.school}</td>
<td>${stu.score}</td>
<td> <a href="${pageContext.request.contextPath}/StudentServlet?method=toUpdatePage&id=${stu.id}">修改</a></td><!-- TOUpdate?id=${ stu.id}&name=${stu.name}&school=${stu.school}&score=${stu.score}之前用的方法 -->
<td> <a href="${pageContext.request.contextPath}/StudentServlet?method=Delete&id=${stu.id}">删除</a></td>
</tr>
</c:forEach>
<tr><td colspan="" align="center"><a href="/Student-Sql/TOInsert">添加</a></td></tr>
</table>
<br>
<%@ include file="/WEB-INF/view/paging.jsp" %>
</body>
</html>
insert.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="${pageContext.request.contextPath}/StudentServlet?method=Add" method="post">
姓名:<input type="text" name="name"/><br>
学校:<input type="text" name="school"/><br>
分数:<input type="text" name="score"/><br>
<input type="submit" value="添加信息"/>
</form>
</body>
</html>
update.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%-- <table border="" align="center" width="50%" >
<tr>
<th>原信息</th>
<th>新信息</th>
</tr>
<c:forEach items="${student2}" var="stu">
<form action="/Student-Sql/UpdateServlet?id=${stu.id}" method="post">
<tr>
<td>${stu.id}</td>
<td>ID:${stu.id}</td>
</tr>
</c:forEach>
<c:forEach items="${student2}" var="stu">
<tr> <td>${stu.name}</td>
<td>姓名:<input type="text" name="name"/></td>
</tr>
</c:forEach>
<c:forEach items="${student2}" var="stu">
<tr>
<td>${stu.school}</td>
<td>学校:<input type="text" name="school"/></td>
</tr>
</c:forEach>
<c:forEach items="${student2}" var="stu">
<tr>
<td>${stu.score}</td>
<td>分数:<input type="text" name="score"/></td>
</tr>
<tr><td> </td> <td><input type="submit" value="修改信息 "></td></tr>
</c:forEach>
</form>
</table> --%>
<form action="${pageContext.request.contextPath}/StudentServlet?method=Update&id=${stu.id}" method="post" >
<%-- <input type="hidden" name="id" value="${stu.id}"/> --%>
姓名:<input type="text" name="name" value="${stu.name}"/>
学校:<input type="text" name="school" value="${stu.school}"/>
分数:<input type="text" name="score" value="${stu.score}"/>
<input type="submit" value="修改信息 ">
</form>
</body>
</html>
paging.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<div id="page_nav" align="center">
<a href="${page.path}&pageNo=1">首页</a>
<a href="${page.path}&pageNo=${page.pageNumber -1 }">上一页</a>
<c:choose>
<c:when test="${page.totalPage <= 5 }" >
<c:set var="begin" value=""></c:set>
<c:set var="end" value="${page.totalPage}"></c:set>
</c:when>
<c:when test="${page.pageNumber <= 3 }">
<c:set var="begin" value=""></c:set>
<c:set var="end" value=""></c:set>
</c:when>
<c:otherwise>
<c:set var="begin" value="${page.pageNumber-2}"></c:set>
<c:set var="end" value="${page.pageNumber+2}"></c:set>
<c:if test="${end > page.totalPage }">
<c:set var="begin" value="${page.totalPage-4}"></c:set>
<c:set var="end" value="${page.totalPage}"></c:set>
</c:if>
</c:otherwise>
</c:choose>
<c:forEach begin="${begin }" end="${end}" var="num">
<c:if test="${page.pageNumber == num }">
【${num}】
</c:if>
<c:if test="${page.pageNumber != num }">
<a href="${page.path}&pageNo=${num}">${num }</a>
</c:if>
</c:forEach>
<a href="${page.path}&pageNo=${page.pageNumber +1}">下一页</a>
<a href="${page.path}&pageNo=${page.totalPage}">末页</a>
共${page.totalPage }页,${page.totalRecord }条记录到,去第<input value="${page.totalPage }" name = "pn" id ="pn_input"/>页
<input type="button" value="确定" id="btn_id"/>
<script type="text/javascript">
$("#btn_id").click(function(){
var value= $("#pn_input").val();
window.location="${page.path}&pageNo="+value;
});
</script>
</div>
最后。。导包
SQL前后端分页的更多相关文章
- Thymeleaf前后端分页查询
分页查询是一个很常见的功能,对于分页也有很多封装好的轮子供我们使用. 比如使用mybatis做后端分页可以用Pagehelper这个插件,如果使用SpringDataJPA更方便,直接就内置的分页查询 ...
- bootstrap table 前后端分页(超级简单)
前端分页:数据库查询所有的数据,在前端进行分页 后端分页:每次只查询当前页面加载所需要的那几条数据 下载bootstrap 下载bootstrap table jquery谁都有,不说了 项目结构:T ...
- Bootstrap-table学习笔记(二)——前后端分页模糊查询
在使用过程中,一边看文档一边做,遇到了一些困难的地方,在此记录一下,顺便做个总结: 1,前端分页 2,后端分页 3,模糊查询 前端分页相当简单,在我添加了2w条测试数据的时候打开的很流畅,没有卡顿. ...
- 前后端分离djangorestframework——分页组件
Pagination 为什么要分页也不用多说了,大家都懂,DRF也自带了分页组件 这次用 前后端分离djangorestframework——序列化与反序列化数据 文章里用到的数据,数据库用的my ...
- 结合jquery的前后端加密解密 适用于WebApi的SQL注入过滤器 Web.config中customErrors异常信息配置 ife2018 零基础学院 day 4 ife2018 零基础学院 day 3 ife 零基础学院 day 2 ife 零基础学院 day 1 - 我为什么想学前端
在一个正常的项目中,登录注册的密码是密文传输到后台服务端的,也就是说,首先前端js对密码做处理,随后再传递到服务端,服务端解密再加密传出到数据库里面.Dotnet已经提供了RSA算法的加解密类库,我们 ...
- 前后端分离进阶一:使用ElementUI+前端分页
前两篇入门:前后端分离初体验一:前端环境搭建 前后端分离初体验二:后端环境搭建+数据交互 参考:https://www.bilibili.com/video/BV137411B7vB B站UP:楠哥教 ...
- vue中使用分页组件、将从数据库中查询出来的数据分页展示(前后端分离SpringBoot+Vue)
文章目录 1.看实现的效果 2.前端vue页面核心代码 2.1. 表格代码(表格样式可以去elementui组件库直接调用相应的) 2.2.分页组件代码 2.3 .script中的代码 3.后端核心代 ...
- dotnetcore vue+elementUI 前后端分离架二(后端篇)
前言 最近几年前后端分离架构大行其道,而且各种框架也是层出不穷.本文通过dotnetcore +vue 来介绍 前后端分离架构实战. 涉及的技术栈 服务端技术 mysql 本项目使用mysql 作为持 ...
- springboot + mybatis 前后端分离项目的搭建 适合在学习中的大学生
人生如戏,戏子多半掉泪! 我是一名大四学生,刚进入一家软件件公司实习,虽说在大学中做过好多个实训项目,都是自己完成,没有组员的配合.但是在这一个月的实习中,我从以前别人教走到了现在的自学,成长很多. ...
随机推荐
- 详解window.history
http://blog.csdn.net/woxueliuyun/article/details/51075272
- Jenkins+Gitlab+Ansible自动化部署(二)
接Jenkins+Gitlab+Ansbile自动化部署(一):https://www.cnblogs.com/zd520pyx1314/p/10210727.html Ansible的配置与部署 工 ...
- CentOS7.2安装MySql5.7并开启远程连接授权
1.安装mysql5.7 CentOS 7之后的版本yum的默认源中使用MariaDB替代原先MySQL,因此安装方式较为以往有一些改变: 下载mysql的源 wget http://dev.mysq ...
- SQL server下所有表名及字段名及注释查询
--查询所有表及注释SELECTA.name ,C.valueFROM sys.tables A LEFT JOIN sys.extended_properties C ON C.major_id = ...
- springBoot jpa 表单关联查询
1.创建两个实体类 import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.per ...
- JavaScript笔记3--标识符和保留字
1.标识符 javaScript标识符必须以字母,下划线(_)或美元符($)开始.后续的字符可以是字母/数字/下划线/美元符.也可以使用非英语语言或数学符号来书写标识符; 2.保留字 break/de ...
- 对fgets末尾'\0'的处理
之所以要对fgets自动添加的字符进行处理的原因之一是:当你想比较输入的字符时,你会发现输入的字符和源码用来进行对比的字符一模一样,但是使用strcmp比较时就是不一样,原因就是fgets对输入字符添 ...
- setup命令
setup——配置网络(centos) 命令所在路径:usr/bin/setup 示例1: # setup
- IM云通信行业步入快车道,谁将成为代表中国的全球IM“独角兽”?
2016年,Twilio的成功上市,以及抢眼的股价表现,拓宽了全球云通信行业的想象空间,行业内公司估值水平也集体上调. 在中国,IM云通信行业也从2016年开始进入了一个“黄金发展时期”,一批如融云. ...
- UVA 11627 Slalom(二分)
二分,判断的时候,一个点一个点的考虑肯定是不行啦,考虑的单位是一个区间, 每次左端点尽量向左边移动,右端点尽量向右,得到下次可以达到的范围,检查一下和下一个区间有没有交集. #include<b ...