jsp页面编写

add.jsp

<%--
Created by IntelliJ IDEA.
User: Administrator
Date: 2/28/2020
Time: 9:13 PM
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>用户添加</title>
</head>
<body>
<form action="${pageContext.request.contextPath}/addServlet" method="post">
<table border="1" >
<tr>
<td colspan="2"><h1>用户添加</h1></td>
</tr>
<tr>
<td>用户名:</td>
<td><input type="text" name="username"/></td>
</tr>
<tr>
<td>密码:</td>
<td><input type="password" name="password"/></td>

</tr>
<tr>
<td colspan="2">
<input type="submit" value="提交">
<input type="reset" value="重置">
</td>
</tr>
</table>
</form>
</body>
</html>

 

 

index.jsp

<%--
Created by IntelliJ IDEA.
User: Administrator
Date: 2/28/2020
Time: 9:13 PM
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>用户展示</title>
</head>
<body>
<h1>用户展示</h1>
<h2>${deleted}</h2>
<table>
<tr>
<td>编号</td>
<td>用户名</td>
<td>密码</td>
<td>操作</td>
</tr>
<c:forEach items="${list}" var="item">
<tr>
<td>${item.id}</td>
<td>${item.username}</td>
<td>${item.password}</td>
<td><a href="${pageContext.request.contextPath}/deleteServlet?id=${item.id}">删除</a>-----<a href="${pageContext.request.contextPath}/updateServlet?id=${item.id}">编辑</a> </td>
</tr>
</c:forEach>
<tr>
<td colspan="2" style="text-align: left"><a href="add.jsp">用户添加</a> </td>
</tr>
</table>

</body>
</html>

 

 

update.jsp

<%--
Created by IntelliJ IDEA.
User: Administrator
Date: 2/28/2020
Time: 9:14 PM
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>用户编辑</title>
</head>
<body>
<form action="${pageContext.request.contextPath}/updateServlet" method="post" style="align-items: center">
<table border="1" >
<tr>
<td colspan="2"><h1>用户编辑</h1></td>
</tr>
<tr>
<td>id</td>
<td><input type="text" name="id" value="${user.id}" /></td>
</tr>
<tr>
<td>姓名</td>
<td><input type="text" name="username" value="${user.username}" /></td>
</tr>
<tr>
<td>密码</td>
<td><input type="text" name="password" value="${user.password}" /></td>
</tr>

<tr>
<td colspan="2">
<input type="submit" value="提交"/>
<input type="button" value="Back" onclick="history.go(-1)"/>
</td>

</tr>
</table>

</form>
</body>
</html>
————————————————

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原文链接:https://blog.csdn.net/johnfht/article/details/104577603

posted @ 2024-02-23 15:19  涨涨涨张  阅读(6)  评论(0编辑  收藏  举报