JSP+servlet对数据库数据增删改查

<%--
  Created by IntelliJ IDEA.
  User: Lenovo
  Date: 2021/12/6
  Time: 16:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="C" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <style>
        table trth, td {
            text-align: center;
        }

        button {
            border: none;
            width: 80px;
            height: 27px;
            border-radius: 5px;
            background-color: #888888;
            box-sizing: content-box;
        }

        input {
            width: 180px;
            height: 25px;
            opacity: 0.5;
            border-radius: 5px;
            margin-right: 5px;
        }
    </style>
</head>
<body>
<h3>员工信息</h3>
<hr>

<table border="1px" width="600px" cellpadding="8px" cellspacing="0" align="center" bgcolor="#c0c0c0">
    <tr>
        <th colspan="6" style="text-align: center"><input type="text" placeholder="请输入eid进行查找"></th>
        <th><button>查找</button></th>
    </tr>
    <form action="add" method="post">
        <tr>
            <th><input type="text" placeholder="eid" name="eid"></th>
            <th><input type="text" placeholder="name" name="name"></th>
            <th><input type="date" placeholder="birthday" name="birthday"></th>
            <th><input type="text" placeholder="phone" name="phone"></th>
            <th><input type="text" placeholder="salary" name="salary"></th>
            <th><input type="text" placeholder="did" name="did"></th>
            <th>
                <button>添加</button>
            </th>
        </tr>
    </form>
    <tr>
        <th>eid</th>
        <th>name</th>
        <th>birthday</th>
        <th>phone</th>
        <th>salary</th>
        <th>did</th>
        <th>修改</th>
    </tr>
    <c:forEach items="${emps}" var="emp">
        <tr>
            <td>${emp.eid}</td>
            <td>${emp.name}</td>
            <td>${emp.birthday}</td>
            <td>${emp.phone}</td>
            <td>${emp.salary}</td>
            <td>${emp.did}</td>
            <td style="text-align: center">
                <button onclick="remove(${emp.eid})">删除</button>
                |
                <button onclick="eidemp(${emp.eid})">修改</button>
            </td>
        </tr>
        <c:choose>
            <c:when test="${emp.eid==index}">
                <tr>
                    <form action="eidemp">
                        <th><input type="text" placeholder="${emp.eid}" name="eid" value="${index}" readonly></th>
                        <th><input type="text" placeholder="name" name="name" value="${emp.name}"></th>
                        <th><input type="date" placeholder="birthday" name="birthday
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值