本系列博客汇总在这里:企业信息管理系统汇总
目录
- 用户删除
- 新建 delete.jsp 文件
- 效果图
- 附件
- 附件一
用户删除
新建 delete.jsp 文件
源码见附件一。
效果图
首页点击删除以后的效果。
当前阶段项目文件
附件
附件一
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.util.*" %>
<%@page import="java.sql.*" %>
<%@page import="com.wyx.ces.*" %>
<%@page import="com.wyx.ces.model.*" %>
<%@page import="java.math.BigDecimal"%>
<%@page import="java.text.SimpleDateFormat"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
a
{
text-decoration: none;
}
body
{
font-size:12px;
color: #033D61;
}
.tableb
{
border-collapse: collapse;
width: 60%;
}
.tableb th, .tableb td
{
border: 1px solid #33A9D0;
height: 20px;
}
th
{
background-color: #E7F2FA;
}
</style>
</head>
<body>
<span>当前位置:用户管理>>用户添加</span>
<%
request.setCharacterEncoding("UTF-8");
String userIdStr = request.getParameter("userId");
Integer userId = null;
if(userIdStr != null)
{
userId = new Integer(userIdStr);
}
//定义添加用户sql
String sql = "delete from cs_user where user_id = ?";
PreparedStatement pstmt = null;
try
{
pstmt = DBUtil.getPstmt(sql);
pstmt.setInt(1, userId);
pstmt.executeUpdate();
}
catch(Exception ex)
{
ex.printStackTrace();
}
finally
{
DBUtil.closeResUpdate(pstmt);
}
//重定向到列表页面
response.sendRedirect("/ces/tab/tab.jsp");
%>
</body>
</html>
如有错误,欢迎指正!