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>
    
    
  • 相关阅读:
    【ArcGIS 10.2新特性】ArcGIS 10.2 for Desktop 新特性(二)
    手势(Gesture)的增加和识别
    [转]C#自定义开关按钮控件--附带第一个私活项目截图
    当年的试用期周工作心得
    FREESWITCH SEESION
    基于三星ARM9(S3C2410)的交通违章抓拍系统的开发
    Apache Kafka: Next Generation Distributed Messaging System---reference
    How and Why Unsafe is Used in Java---reference
    基于keepalived对redis做高可用配置---转载
    Java获取真实的IP地址--转载
  • 原文地址:https://www.cnblogs.com/charlottepl/p/12573664.html
Copyright © 2011-2022 走看看