jsp写一个页面美观的学生信息管理代码
时间: 2024-01-05 10:43:29 浏览: 38
以下是一个简单的学生信息管理页面的 JSP 代码,使用 Bootstrap 组件实现美观的界面:
```
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>学生信息管理</title>
<!-- 引入 Bootstrap 样式 -->
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h1 class="text-center">学生信息管理</h1>
<hr>
<div class="row">
<div class="col-md-6">
<form action="addStudent.jsp" method="post">
<h3>添加学生</h3>
<div class="form-group">
<label for="name">姓名:</label>
<input type="text" id="name" name="name" class="form-control" required>
</div>
<div class="form-group">
<label for="gender">性别:</label>
<select id="gender" name="gender" class="form-control" required>
<option value="男">男</option>
<option value="女">女</option>
</select>
</div>
<div class="form-group">
<label for="age">年龄:</label>
<input type="number" id="age" name="age" class="form-control" required>
</div>
<button type="submit" class="btn btn-primary">添加</button>
</form>
</div>
<div class="col-md-6">
<h3>学生列表</h3>
<table class="table">
<thead>
<tr>
<th>姓名</th>
<th>性别</th>
<th>年龄</th>
</tr>
</thead>
<tbody>
<%-- TODO: 根据数据库中的学生信息动态生成表格行 --%>
</tbody>
</table>
</div>
</div>
</div>
<!-- 引入 Bootstrap JavaScript 组件 -->
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.3/js/bootstrap.min.js"></script>
</body>
</html>
```
你需要根据自己的具体需求,修改 TODO 标记的部分,动态生成表格行,从数据库中读取学生信息并在页面上呈现。
另外,如果你使用了 Spring 框架或其他 MVC 框架,你应该使用模板引擎(如 Thymeleaf、Freemarker)来生成页面,而不是直接编写 JSP 代码。
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)