0
点赞
收藏
分享

微信扫一扫

企业信息管理系统(9)_用户删除

绪风 2022-03-30 阅读 64


本系列博客汇总在这里:企业信息管理系统汇总


目录

  • ​​用户删除​​
  • ​​新建 delete.jsp 文件​​
  • ​​效果图​​
  • ​​附件​​
  • ​​附件一​​

用户删除

新建 delete.jsp 文件

源码见附件一。

企业信息管理系统(9)_用户删除_用户删除

效果图

首页点击删除以后的效果。

企业信息管理系统(9)_用户删除_用户删除_02

当前阶段项目文件

附件

附件一

<%@ 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"%>
<!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>
<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>

如有错误,欢迎指正!



举报

相关推荐

0 条评论