Spring+hibernate+JSP实现Piano的数据库操作---5.JSP页面

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>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值