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>
    
    
  • 相关阅读:
    算法竞赛入门经典训练指南
    git保护--git分支创建
    解决多个iframe嵌套而造成的多个滚动条问题
    css如何让div元素铺满整个屏幕
    第一个用python3写的爬虫小例子
    用JS获取当前页面的URL以及截取其中的字段
    css处理超出文本截断问题的两种情况(多行或者单行)
    约数的个数
    成绩排序
    八进制
  • 原文地址:https://www.cnblogs.com/charlottepl/p/12573664.html
Copyright © 2011-2022 走看看