jsp 实现修改和删除功能
main.jsp 实现查询 在此界面快捷方式到修改界面
点击修改 会把数据传递到exit.jsp
修改 edit.jsp
前面数据:
数据库:
/*
Navicat Premium Data Transfer Source Server : c10.87.12.251
Source Server Type : SQL Server
Source Server Version : 11002100
Source Host : 10.87.12.251:1433
Source Catalog : userdb
Source Schema : dbo Target Server Type : SQL Server
Target Server Version : 11002100
File Encoding : 65001 Date: 19/06/2019 22:19:40
*/ -- ----------------------------
-- Table structure for userinfo
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[userinfo]') AND type IN ('U'))
DROP TABLE [dbo].[userinfo]
GO CREATE TABLE [dbo].[userinfo] (
[id] int IDENTITY(1,1) NOT NULL,
[username] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
[userpwd] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
[sex] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
[age] int NULL,
[address] varchar(50) COLLATE Chinese_PRC_CI_AS NULL
)
GO ALTER TABLE [dbo].[userinfo] SET (LOCK_ESCALATION = TABLE)
GO -- ----------------------------
-- Records of [userinfo]
-- ----------------------------
SET IDENTITY_INSERT [dbo].[userinfo] ON
GO INSERT INTO [dbo].[userinfo] ([id], [username], [userpwd], [sex], [age], [address]) VALUES (N'', N'root', N'', N'', N'', N'')
GO SET IDENTITY_INSERT [dbo].[userinfo] OFF
GO
用户信息数据库代码
(1)db/DbConn.java
package db; import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement; public class DbConn { public static Connection getConn()
{
Connection con =null;
try {
// Class.forName("com.mysql.jdbc.Driver"); // 加载驱动程序
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); } catch (ClassNotFoundException e) {
System.out.println("加载驱动程序错误" + e.getMessage());
} try {
// 创建连接 testdb是数据库名称
con = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;DatabaseName=userdb", "sa", "123456"); } catch (SQLException e) { System.out.println("数据库连接操作出错" + e.getMessage());
}
return con;
}
}
l连接数据库代码
(2) po/User.java
package po; public class User {
int id;
String username;
String password;
int age;
String sex;
String address; public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
} }
交互相关字段
(3) dao/UserDAO.java
//根据id 查找字段 返回给edit表
public User getUser(int id)
{
User u=new User();
try {
// 创建连接 testdb是数据库名称
Connection con =DbConn.getConn();
// 创建声明SQL对象
Statement stm = con.createStatement();
// 执行SQL语句,得到结果集,结果集放到ResultSet对象中
ResultSet rs = stm.executeQuery("select * from userinfo where id="+id);
// 通过循环,从结果集对象中取得数据
while (rs.next()) { String username = rs.getString("username"); // 取得字符类型的字段username的值,
String userpwd = rs.getString("userpwd");
String sex=rs.getString("sex");
int age=rs.getInt("age");
String address=rs.getString("address"); u.setId(id);
u.setUsername(username);
u.setPassword(userpwd);
u.setSex(sex);
u.setAge(age);
u.setAddress(address); }
} catch (SQLException e) { System.out.println("数据库操作出错" + e.getMessage());
}
return u;
}
//插入新数据 根据id
public int edit(User u)
{
int n=0;
try {
// 创建连接 testdb是数据库名称
Connection con = DbConn.getConn(); // 创建声明SQL对象
Statement stm = con.createStatement();
// 执行SQL语句,得到结果集,结果集放到ResultSet对象中
String sql="update userinfo set username='"+u.getUsername()+"',userpwd='"+u.getPassword()+"',sex='"+u.getSex()+"',age="+u.getAge()+",address='"+u.getAddress()+"' " +
"where id="+u.getId()+"";
n=stm.executeUpdate(sql);
} catch (SQLException e) { System.out.println("数据库操作出错" + e.getMessage());
}
return n;
}
根据id 查找字段返回给edit表和插入数据
public List<User> getUserList()
{
List<User> ls=new ArrayList<User>();
try {
// 创建连接 testdb是数据库名称
Connection con =DbConn.getConn();
// 创建声明SQL对象
Statement stm = con.createStatement();
// 执行SQL语句,得到结果集,结果集放到ResultSet对象中
ResultSet rs = stm.executeQuery("select * from userinfo");
// 通过循环,从结果集对象中取得数据
while (rs.next()) {
int id = rs.getInt("id"); // 取得int类型的字段id的值,
String username = rs.getString("username"); // 取得字符类型的字段username的值,
String userpwd = rs.getString("userpwd");
String sex=rs.getString("sex");
int age=rs.getInt("age");
String address=rs.getString("address");
User u=new User();
u.setId(id);
u.setUsername(username);
u.setPassword(userpwd);
u.setSex(sex);
u.setAge(age);
u.setAddress(address);
ls.add(u);
}
} catch (SQLException e) { System.out.println("数据库操作出错" + e.getMessage());
}
return ls;
}
查询所有信息
public boolean login(String username,String userpwd)
{
boolean flag=false;
try {
// 创建连接 testdb是数据库名称
Connection con = DbConn.getConn();
// 创建声明SQL对象
Statement stm = con.createStatement();
// 执行SQL语句,得到结果集,结果集放到ResultSet对象中
ResultSet rs = stm.executeQuery("select * from userinfo where username='"+username+"' and userpwd='"+userpwd+"' ");
// 通过循环,从结果集对象中取得数据
if(rs.next()) {
flag=true;
}
else
{
flag=false;
} } catch (SQLException e) { System.out.println("数据库操作出错" + e.getMessage());
}
return flag;
}
login 验证
(4)servlet
main里面的 <td><a href="servlet/GetUserServlet?userid=<%=u.getId()%>">修改</a></td> 调用 GetUserServlet 调用UserDAO. getUser(int id) 方法
GetUserServlet.java
package servlet; import java.io.IOException;
import java.io.PrintWriter;
import java.util.List; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import po.User;
import dao.UserDAO; public class GetUserServlet extends HttpServlet { /**
* Constructor of the object.
*/
public GetUserServlet() {
super();
} /**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
} /**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
} /**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { response.setContentType("text/html");
PrintWriter out = response.getWriter();
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>"); //根据id 查找到所有字段返回给exit.jsp HttpSession session=request.getSession(true);
String sid=request.getParameter("userid");
int id=Integer.parseInt(sid);
UserDAO udao=new UserDAO();
User u= udao.getUser(id);
//传递给session 对象
session.setAttribute("user", u);
response.sendRedirect("../edit.jsp"); out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
} /**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
} }
根据id 查找到所有字段返回给exit.jsp
edit.jsp 修改好后的传递给
EditServlet.java
package servlet; import java.io.IOException;
import java.io.PrintWriter; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import po.User;
import dao.UserDAO; public class EditServlet extends HttpServlet { /**
* Constructor of the object.
*/
public EditServlet() {
super();
} /**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
} /**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { doPost(request,response);
} /**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { response.setContentType("text/html");
PrintWriter out = response.getWriter();
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
//获取edit 传递的字段 String userid=request.getParameter("userid");
String username=request.getParameter("username");
String userpwd=request.getParameter("userpwd");
String sex=request.getParameter("sex");
String age=request.getParameter("age");
String address=request.getParameter("address"); User u=new User();
u.setId(Integer.parseInt(userid));
u.setUsername(username);
u.setPassword(userpwd);
u.setSex(sex);
u.setAge(Integer.parseInt(age));
u.setAddress(address); //调用方法
UserDAO udao=new UserDAO(); int n=udao.edit(u);
if(n>0) {
//成功就调用查询方法 看修改完后的
response.sendRedirect("../servlet/GetUsersServlet");
}
else
{
out.println("修改失败");
} out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
} /**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
} }
从edit.jsp获取数据在调用修改函数 给数据库
login.jsp 调用
package servlet; import java.io.IOException;
import java.io.PrintWriter;
import java.sql.*; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import dao.UserDAO;
import db.DbConn; public class LoginServlet extends HttpServlet { /**
* Constructor of the object.
*/
public LoginServlet() {
super();
} /**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
} /**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
} /**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { response.setContentType("text/html");
PrintWriter out = response.getWriter();
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>"); String username=(String)request.getParameter("username");
String userpwd=(String)request.getParameter("password"); UserDAO udao=new UserDAO();
boolean flag= udao.login(username, userpwd); if(flag==true){
out.print("success"); response.sendRedirect("../servlet/GetUsersServlet"); }
else
out.print("false"); out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
} /**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
} }
LoginServlet.java
查询所有GetUsersServlet.java
package servlet; import java.io.IOException;
import java.io.PrintWriter;
import java.util.List; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import po.User; import dao.UserDAO; public class GetUsersServlet extends HttpServlet { /**
* Constructor of the object.
*/
public GetUsersServlet() {
super();
} /**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
} /**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
} /**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { response.setContentType("text/html");
PrintWriter out = response.getWriter();
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
HttpSession session=request.getSession(true); UserDAO udao=new UserDAO();
List<User> ls= udao.getUserList();
session.setAttribute("userlist", ls);
response.sendRedirect("../main.jsp"); out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
} /**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
} }
获取所有数据
DelServlet.java
package servlet; import java.io.IOException;
import java.io.PrintWriter;
import java.sql.*; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import db.DbConn; public class DelServlet extends HttpServlet { /**
* Constructor of the object.
*/
public DelServlet() {
super();
} /**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
} /**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
} /**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { response.setContentType("text/html");
PrintWriter out = response.getWriter();
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>"); String userid=request.getParameter("userid");
out.println(userid); try {
// 创建连接 testdb是数据库名称
Connection con = DbConn.getConn();
// 创建声明SQL对象
Statement stm = con.createStatement();
// 执行SQL语句,得到结果集,结果集放到ResultSet对象中 int n=stm.executeUpdate(sql);
if(n>0) {
response.sendRedirect("../servlet/GetUsersServlet"); }
else
{
out.println("删除失败");
} } catch (SQLException e) { System.out.println("数据库操作出错" + e.getMessage());
} out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
} /**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
} }
删除
1.main.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="po.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'main.jsp' starting page</title>
</head> <body>
<table width="502" border="1">
<tr>
<td width="37">序号</td>
<td width="63">姓名</td>
<td width="52">密码</td>
<td width="52">年龄</td>
<td width="61">性别</td>
<td width="197">地址</td>
<td width="80">删除</td>
<td width="80">修改</td>
</tr>
<% List<User> ls=(List<User>)session.getAttribute("userlist");
for(int i=0;i<ls.size();i++)
{
User u=ls.get(i);
%>
<tr>
<td><%=u.getId()%></td>
<td><%=u.getUsername()%></td>
<td><%=u.getPassword()%></td>
<td><%=u.getAge()%></td>
<td><%=u.getSex()%></td>
<td><%=u.getAddress()%></td>
<td><a href="servlet/DelServlet?userid=<%=u.getId()%>">删除</a></td>
<td><a href="servlet/GetUserServlet?userid=<%=u.getId()%>">修改</a></td>
</tr>
<%
}
%>
</table>
<a href="add.jsp">添加</a>
</body>
</html>
查询界面和修改界面
2.修改 edit.jsp
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ page import="po.*" %>
<!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=ISO-8859-1">
<title>Insert title here</title>
</head>
<body> <%
User u=(User)session.getAttribute("user");
%>
<p>用户添加</p>
<form name="frm1" action="servlet/EditServlet">
<p>姓名:
<label for="textfield"></label>
<input type="text" name="username" id="textfield" value="<%=u.getUsername() %>"/>
<input type="hidden" name="userid" id="textfield" value="<%=u.getId() %>"/>
</p>
<p>密码:
<input type="text" name="userpwd" id="textfield2" value="<%= u.getPassword()%>"/>
</p>
<p>年龄:
<input type="text" name="age" id="textfield3" value="<%=u.getAge() %>"/>
</p>
<p>性别:
<input type="text" name="sex" id="textfield4" value="<%=u.getSex() %>"/>
</p>
<p>地址:
<input type="text" name="address" id="textfield5" value="<%=u.getAddress() %>"/>
</p>
<p> </p>
<input type="submit" value="确定"/>
</form>
</body>
</html>
edit.jsp
3.Login
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'Login.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head> <body>
<div align="center" >
<form method="get" action="servlet/LoginServlet">
用户名:<input type="text" name="username"><br>
密码:<input type="password" name="password"><br>
<input type="submit" name="button1" value="登录">
</form>
</div>
</body>
</html>
Login.jsp 它调用LoginServle至main.jspt
运行过程
修改的运行过程: Login.jsp--->LoginServlet-->main.jsp-->GetUserServlet->exit.jsp->EditServlet ->main.jsp
jsp 实现修改和删除功能的更多相关文章
- datagrid的修改和删除功能的实现
1.修改 双击,进入一行的编辑状态的功能的实现 2.删除 3.扩展easyui的datagrid,添加动态增加或删除Editor的方法 (1)背景要求: 对于某一列,比如密码,动态增加时候,是可以编辑 ...
- 微信小程序云开发-云函数-云函数实现数据的查询、修改和删除功能
一.云函数获取商品信息 1.创建云函数getData,云函数功能:获取商品信息 2.在本地小程序页面调用云函数getData 二.云函数修改商品信息 1.创建云函数updateData,云函数功能: ...
- 基于SpringBoot从零构建博客网站 - 新增创建、修改、删除专栏功能
守望博客是支持创建专栏的功能,即可以将一系列相关的文章归档到专栏中,方便用户管理和查阅文章.这里主要讲解专栏的创建.修改和删除功能,至于专栏还涉及其它的功能,例如关注专栏等后续会穿插着介绍. 1.创建 ...
- Jquery EasyUI的添加,修改,删除,查询等基本操作介绍
http://www.jb51.net/article/42016.htm 初识Jquery EasyUI看了一些博主用其开发出来的项目,页面很炫,感觉功能挺强大,效果也挺不错,最近一直想系统学习一套 ...
- 摘:通过ICursor对Table进行操作(添加、修改、删除)
通过ICursor对Table进行操作(添加.修改.删除) 连接上数据表的目的就是对其进行包括浏览.添加.修改.删除等基本操作. 浏览功能,之前文章中一提到,就是将Itable转换为DataTable ...
- 通过ICursor对Table进行操作(添加、修改、删除)
通过ICursor对Table进行操作(添加.修改.删除) 2010-03-16 16:07:37| 分类: 工作|举报|字号 订阅 来自:http://blog.163.com/liuyang12 ...
- MVC5 网站开发之七 用户功能 3用户资料的修改和删除
这次主要实现管理后台界面用户资料的修改和删除,修改用户资料和角色是经常用到的功能,但删除用户的情况比较少,为了功能的完整性还是坐上了.主要用到两个action "Modify"和& ...
- MVC5 网站开发之八 栏目功能 添加、修改和删除
本次实现栏目的浏览.添加.修改和删除. 栏目一共有三种类型. 常规栏目-可以添加子栏目,也可以添加内容模型.当不选择内容模型时,不能添加内容. 单页栏目-栏目只有一个页面,可以设置视图. 链接栏目-栏 ...
- input file样式修改,图片预览删除功能
本篇对input file进行了修改,改成自己需要的样式,类似验证身份上传身份证图片的功能. 效果图如下: 这里主要展示上传预览图片功能,对于删除功能的html及css写的比较粗糙,对于想要精细表现这 ...
随机推荐
- 第二十六章 system v消息队列(二)
msgsnd int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); 作用: 把一条消息添加到消息队列中 参数: msqi ...
- 「刷题」GERALD07加强版
是LCT了. 首先我们不知道联通块怎么数. 然后颓标签知道了是LCT. 那么考虑一下怎么LCT搞. 有一个很普遍的思路大家也应该都知道,就是如何求一个区间中某种颜色的个数. 这个可以很简单的用主席树来 ...
- ElasticSearch(三):通分词器(Analyzer)进行分词(Analysis)
ElasticSearch(三):通过分词器(Analyzer)进行分词(Analysis) 学习课程链接<Elasticsearch核心技术与实战> Analysis与Analyzer ...
- vue proxyTable代理 解决开发环境的跨域问题
如果我们项目请求的地址为 htttp://xxxx.com/a/b/c 可以设置代理为: dev:{ assetsSubDirectory: 'static',// 静态资源文件夹 assetsPub ...
- Scrapy进阶知识点总结(三)——Items与Item Loaders
一.Items 抓取的主要目标是从非结构化源(通常是网页)中提取结构化数据.Scrapy蜘蛛可以像Python一样返回提取的数据.虽然方便和熟悉,但Python缺乏结构:很容易在字段名称中输入拼写错误 ...
- [LINQ2Dapper]最完整Dapper To Linq框架(三)---实体类关系映射
此特性需要安装Kogel.Dapper.Mssql或者Oracle 3.06及以上版本,实体类层需要安装Kogel.Dapper.Extension 3.06及以上版本 目录 [LINQ2Dapper ...
- 014.Kubernetes二进制部署docker
一 部署docker 1.1 部署docker组件 docker 运行和管理容器,kubelet 通过 Container Runtime Interface (CRI) 与它进行交互. 1.2 下载 ...
- 虚幻4 UE4 蓝图之关卡蓝图实现自动开关门
新建项目 往关卡中放置一个门 在内容浏览器中找到 门 的静态网格体 拖放到关卡中 此时门默认没有碰撞,人物可以直接穿过 给门添加碰撞 双击内容管理器中的 SM_Door,打开编辑窗口 选择菜单&quo ...
- 回声消除中的LMS和NLMS算法与MATLAB实现
自适应滤波是数字信号处理的核心技术之一,在科学和工业上有着广泛的应用领域.自适应滤波技术应用广泛,包括回波抵消.自适应均衡.自适应噪声抵消和自适应波束形成.回声对消是当今通信系统中普遍存在的现象.声回 ...
- flex盒子布局
看过很多对于弹性盒子flex的简介,但还是觉得阮一峰大神的解析和张鑫旭大神(旧版flex)的解析比较容易理解,下面,我以自己的理解来叙述关于flex弹性布局! 1.概念(容器和项目) 在flex中,有 ...