Text Practice Mode
yyeeeeeeeeeee
created Today, 13:32 by Bầu Trời Đầy Sao Sáng
0
481 words
0 completed
0
Rating visible after 3 or more votes
saving score / loading statistics ...
00:00
<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<%@ page import="java.util.List" %>
<%@ page import="model.Sach" %>
<!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<title>Thư Viện</title>
<link rel="stylesheet" type="text/css" href= "assets/newcss.css">
</head>
<body>
<div class="container">
<h1>Tìm kiếm Sách, Xóa Sách, Thêm Sách và Sửa Sách</h1>
<form method = POST>
<div class="form-row">
<label>Mã Sách: </label>
<input type ="number" name="id" placeholder="Nhập mã sách..."><!-- comment -->
<label>Tên Sách: </label>
<input type =" text" name="ten_sach" placeholder="Nhập tên sách..."><!-- comment -->
<label>Giá Sách: </label>
<input type ="number" name="gia" placeholder="Nhập giá sách..."><!-- comment -->
<label>Số Lượng: </label>
<input type ="number" name="so_luong" placeholder="Nhập số lượng..."><!-- comment -->
</div>
<!-- Nút tìm kiếm -->
<button type="submit" formaction="TimS">Tìm kiếm</button>
<!-- Nút xóa -->
<button type="submit" formaction="XoaS">Xóa</button>
<!-- Nút Thêm -->
<button type="submit" formaction="ThemS">Thêm Sách</button>
<!-- Nút Sửa -->
<button type="submit" formaction="SuaS">Sửa Sách</button>
<!-- Các nút phụ -->
<a href="Tao"><button type="button" class="secondary">Hiển thị</button></a>
<a href="view.jsp"><button type="button" class="secondary">Thoát</button></a>
</form>
<!-- Thông báo -->
<%
String message = (String) request.getAttribute("message");
String error = (String) request.getAttribute("error");
if (message != null && !message.isEmpty()) {
%>
<div class="message"><%= message %></div>
<% } %>
<% if (error != null && !error.isEmpty()) { %>
<div class="message error"><%= error %></div>
<% } %>
<!-- Kết quả tìm kiếm một phòng -->
<%
Sach ketQua = (Sach) request.getAttribute("ketQua");
if (ketQua != null) {
%>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>Mã Sách</th>
<th>Tên Sách</th>
<th>Giá Sách</th>
<th>Số Lượng</th>
<th>Giảm giá</th>
<th>Hành động</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= ketQua.getId()%></td>
<td><%= ketQua.getTen_sach()%></td>
<td><%= ketQua.getGia()%></td>
<td><%= ketQua.getSo_luong()%></td>
<td><%= String.format("%,d", ketQua.getGiam_gia()) %> VND</td>
</tr>
</tbody>
</table>
</div>
<% } %>
<!-- Danh sách toàn bộ dữ liệu -->
<%
List<Sach> dsSach = (List<Sach>) request.getAttribute("dsSach");
if (dsSach != null && !dsSach.isEmpty()) {
%>
<h3>Danh sách Sách thư viện hiện có</h3>
<div class="table-wrap">
<table border ="1">
<thead>
<tr>
<th>Mã Sách</th>
<th>Tên Sách</th>
<th>Giá Sách</th>
<th>Số Lượng</th>
<th>Giảm giá</th>
<th>Hành động</th>
</tr>
</thead>
<tbody>
<%
for (Sach s:dsSach) {
%>
<tr>
<td><%= s.getId() %></td>
<td><%= s.getTen_sach() %></td>
<td><%= s.getGia() %></td>
<td><%= s.getSo_luong()%></td>
<td><%= String.format("%,d", s.getGiam_gia()) %> VND</td>
<td>
<form method="POST" action="XoaS">
<input type="hidden" name="id" value="<%= s.getId() %>">
<button type="submit">Xóa</button>
</form>
<form method="POST" action="SuaS">
<input type="hidden" name="id" value="<%= s.getId() %>">
<button type="submit">Sửa</button>
</form>
</td>
</tr>
<% } %>
</tbody>
</table>
</div>
<% } %>
<style>
.container {
max-width: 800px;
margin: auto;
padding: 20px;
}
h1 {
font-size: 50px;
text-align: center;
margin-bottom: 20px;
}
form {
margin-bottom: 30px;
border-radius: 1px;
border: 1px;
}
.form-row {
display: grid;
grid-template-columns: 120px 1fr;
gap: 10px;
margin-bottom: 10px;
align-items: center;
}
input {
padding: 6px;
font-size: 14px;
width: 100%;
}
.button-group {
display: flex;
flex-wrap: wrap;
gap: 10px;
justify-content: center;
margin-top: 15px;
}
button {
padding: 6px 12px;
font-size: 14px;
cursor: pointer;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
border: 1px solid #000;
padding: 6px;
text-align: left;
word-break: break-word;
}
th {
font-weight: bold;
}
.message {
margin-top: 10px;
padding: 10px;
border: 1px solid #000;
}
</style>
</div>
</body>
</html>
<%@ page import="java.util.List" %>
<%@ page import="model.Sach" %>
<!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<title>Thư Viện</title>
<link rel="stylesheet" type="text/css" href= "assets/newcss.css">
</head>
<body>
<div class="container">
<h1>Tìm kiếm Sách, Xóa Sách, Thêm Sách và Sửa Sách</h1>
<form method = POST>
<div class="form-row">
<label>Mã Sách: </label>
<input type ="number" name="id" placeholder="Nhập mã sách..."><!-- comment -->
<label>Tên Sách: </label>
<input type =" text" name="ten_sach" placeholder="Nhập tên sách..."><!-- comment -->
<label>Giá Sách: </label>
<input type ="number" name="gia" placeholder="Nhập giá sách..."><!-- comment -->
<label>Số Lượng: </label>
<input type ="number" name="so_luong" placeholder="Nhập số lượng..."><!-- comment -->
</div>
<!-- Nút tìm kiếm -->
<button type="submit" formaction="TimS">Tìm kiếm</button>
<!-- Nút xóa -->
<button type="submit" formaction="XoaS">Xóa</button>
<!-- Nút Thêm -->
<button type="submit" formaction="ThemS">Thêm Sách</button>
<!-- Nút Sửa -->
<button type="submit" formaction="SuaS">Sửa Sách</button>
<!-- Các nút phụ -->
<a href="Tao"><button type="button" class="secondary">Hiển thị</button></a>
<a href="view.jsp"><button type="button" class="secondary">Thoát</button></a>
</form>
<!-- Thông báo -->
<%
String message = (String) request.getAttribute("message");
String error = (String) request.getAttribute("error");
if (message != null && !message.isEmpty()) {
%>
<div class="message"><%= message %></div>
<% } %>
<% if (error != null && !error.isEmpty()) { %>
<div class="message error"><%= error %></div>
<% } %>
<!-- Kết quả tìm kiếm một phòng -->
<%
Sach ketQua = (Sach) request.getAttribute("ketQua");
if (ketQua != null) {
%>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>Mã Sách</th>
<th>Tên Sách</th>
<th>Giá Sách</th>
<th>Số Lượng</th>
<th>Giảm giá</th>
<th>Hành động</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= ketQua.getId()%></td>
<td><%= ketQua.getTen_sach()%></td>
<td><%= ketQua.getGia()%></td>
<td><%= ketQua.getSo_luong()%></td>
<td><%= String.format("%,d", ketQua.getGiam_gia()) %> VND</td>
</tr>
</tbody>
</table>
</div>
<% } %>
<!-- Danh sách toàn bộ dữ liệu -->
<%
List<Sach> dsSach = (List<Sach>) request.getAttribute("dsSach");
if (dsSach != null && !dsSach.isEmpty()) {
%>
<h3>Danh sách Sách thư viện hiện có</h3>
<div class="table-wrap">
<table border ="1">
<thead>
<tr>
<th>Mã Sách</th>
<th>Tên Sách</th>
<th>Giá Sách</th>
<th>Số Lượng</th>
<th>Giảm giá</th>
<th>Hành động</th>
</tr>
</thead>
<tbody>
<%
for (Sach s:dsSach) {
%>
<tr>
<td><%= s.getId() %></td>
<td><%= s.getTen_sach() %></td>
<td><%= s.getGia() %></td>
<td><%= s.getSo_luong()%></td>
<td><%= String.format("%,d", s.getGiam_gia()) %> VND</td>
<td>
<form method="POST" action="XoaS">
<input type="hidden" name="id" value="<%= s.getId() %>">
<button type="submit">Xóa</button>
</form>
<form method="POST" action="SuaS">
<input type="hidden" name="id" value="<%= s.getId() %>">
<button type="submit">Sửa</button>
</form>
</td>
</tr>
<% } %>
</tbody>
</table>
</div>
<% } %>
<style>
.container {
max-width: 800px;
margin: auto;
padding: 20px;
}
h1 {
font-size: 50px;
text-align: center;
margin-bottom: 20px;
}
form {
margin-bottom: 30px;
border-radius: 1px;
border: 1px;
}
.form-row {
display: grid;
grid-template-columns: 120px 1fr;
gap: 10px;
margin-bottom: 10px;
align-items: center;
}
input {
padding: 6px;
font-size: 14px;
width: 100%;
}
.button-group {
display: flex;
flex-wrap: wrap;
gap: 10px;
justify-content: center;
margin-top: 15px;
}
button {
padding: 6px 12px;
font-size: 14px;
cursor: pointer;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
border: 1px solid #000;
padding: 6px;
text-align: left;
word-break: break-word;
}
th {
font-weight: bold;
}
.message {
margin-top: 10px;
padding: 10px;
border: 1px solid #000;
}
</style>
</div>
</body>
</html>
saving score / loading statistics ...