zoukankan      html  css  js  c++  java
  • 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>
    
    
  • 相关阅读:
    GitLab 介绍
    git 标签
    git 分支
    git 仓库 撤销提交 git reset and 查看本地历史操作 git reflog
    git 仓库 回退功能 git checkout
    python 并发编程 多进程 练习题
    git 命令 查看历史提交 git log
    git 命令 git diff 查看 Git 区域文件的具体改动
    POJ 2608
    POJ 2610
  • 原文地址:https://www.cnblogs.com/charlottepl/p/12573664.html
Copyright © 2011-2022 走看看