1.index.jsp
<%--
Created by IntelliJ IDEA.
User: lenovo
Date: 2020/3/25
Time: 14:09
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Piano</title>
</head>
<body>
<a href= "${pageContext.request.contextPath}/piano/newPiano">新增Piano</a>
<%--${pageContext.request.contextPath}/piano/add--%>
<a href="${pageContext.request.contextPath}/piano/list">list</a>
</body>
</html>
2.piano.jsp
<%--
Created by IntelliJ IDEA.
User: lenovo
Date: 2020/3/25
Time: 17:58
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
新增Piano
<form action="${pageContext.request.contextPath}/piano/add"
method="post">
<table>
<tr>
<td>品牌:</td>
<td><input type="text" name="brand"></td>
</tr>
<tr>
<td>价格:</td>
<td><input type="text" name="price"></td>
</tr>
<tr>
<td>图片:</td>
<td><input type="text" name="pic"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="提交"></td>
</tr>
</table>
</form>
</body>
</html>
3. list.jsp
<%--
Created by IntelliJ IDEA.
User: lenovo
Date: 2020/3/25
Time: 17:58
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</title>
<style>
td {
border: 1px solid #333333;
}
</style>
</head>
<body>
list目录:
<table>
<tr>
<td>ID</td>
<td>brand</td>
<td>price</td>
<td>pic</td>
<td>do</td>
</tr>
<c:forEach items="${list}" var="p">
<tr>
<td>${p.id}</td>
<td>${p.brand}</td>
<td>${p.price}</td>
<td>${p.pic}</td>
<td>
<a href="${pageContext.request.contextPath}/piano/update/${p.id}">修改</a>
<a href="${pageContext.request.contextPath}/piano/del/${p.id}">删除</a>
</td>
</tr>
</c:forEach>
</table>
<hr>
<a href="${pageContext.request.contextPath}/piano/hello">返回</a>
</body>
</html>
4.update.jsp
<%--
Created by IntelliJ IDEA.
User: lenovo
Date: 2020/3/26
Time: 10:19
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
更新Piano
<form action="${pageContext.request.contextPath}/piano/updatePiano/${piano.id}"
method="post">
<table>
<tr></tr>
<tr>
<td>品牌:</td>
<td><input type="text" name="brand" value="${piano.brand}"></td>
</tr>
<tr>
<td>价格:</td>
<td><input type="text" name="price" value="${piano.price}"></td>
</tr>
<tr>
<td>图片:</td>
<td><input type="text" name="pic" value="${piano.pic}"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="提交"></td>
</tr>
</table>
</form>
</body>
</html>
5.result.jsp
<%--
Created by IntelliJ IDEA.
User: lenovo
Date: 2020/3/26
Time: 10:07
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>操作结果</title>
</head>
<body>
${result}
<hr>
<a href="${pageContext.request.contextPath}/piano/hello">返回</a>
</body>
</html>