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>
Spring+hibernate+JSP实现Piano的数据库操作---5.JSP页面的更多相关文章
- Spring+hibernate+JSP实现Piano的数据库操作---4.配置文件
1.applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans ...
- Spring+hibernate+JSP实现Piano的数据库操作---2.Controller+Service+Dao
Controller package com.controller; import com.entity.Piano; import org.dom4j.rule.Mode; import org.s ...
- Spring+hibernate+JSP实现Piano的数据库操作---3.Piano实体类
package com.entity; import org.springframework.stereotype.Component; import javax.persistence.*; @Co ...
- Spring+hibernate+JSP实现Piano的数据库操作---1.目录结构+展示
目录结构 界面
- jsp数据库连接大全和数据库操作封装到Javabean
一.jsp连接Oracle8/8i/9i数据库(用thin模式) testOracle.jsp如下: <%@ page contentType="text/html;charset=g ...
- jsp JDBC连接MySQL数据库操作标准流程参考
1. 此案例以帐号密码后台更新维护为例子,对数据库调取数据更新流程进行演示: 代码示例: <%@page import="java.io.IOException"%> ...
- spring+hibernate--直接修改数据库,再通过hibernate查询数据不变
这个问题已经很多天了,一直没有时间解决,不过还好是自己的项目,没什么影响. 刚好今天没事,想好好解决一下这个问题. hibernate主要配置如下: <property name="h ...
- 基于Spring和Mybatis拦截器实现数据库操作读写分离
首先需要配置好数据库的主从同步: 上一篇文章中有写到:https://www.cnblogs.com/xuyiqing/p/10647133.html 为什么要进行读写分离呢? 通常的Web应用大多数 ...
- spring boot快速入门 4: jpa数据库操作 实现增删改查
spring boot jpa逆向生成表 简单实例: 第一步:pom文件: <?xml version="1.0" encoding="UTF-8"?&g ...
随机推荐
- 使用 Prometheus-Operator 监控 Calico
原文链接:https://fuckcloudnative.io/posts/monitoring-calico-with-prometheus-operator/ Calico 中最核心的组件就是 F ...
- 安装mysql教程
linux下安装mysql 方式一:源码包安装 环境介绍:本安装教程基于虚拟机CentOS7.6版本进行安装,mysql版本为5.7版本. 一.卸载已安装的mysql服务 由于我原本在虚拟机已安装过m ...
- sharepoint 2010项目中,ashx页面获取SPContext.Current 为null的原因和解决方法
//错误的写法 public void ProcessRequest(HttpContext context) { SPSecurity.RunWithElevatedPrivileges(deleg ...
- 收藏 | 14张思维导图-构建Python核心体系!Python语法总结!
今天在看Python时,ZOE的Python思维导图总结的很好,分享一下 链接: https://pan.baidu.com/s/1s6Gtptp-pJS0UliNeRIvjg 提取码: mrfz
- js实现json格式化,以及json校验工具的简单实现
JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式,采用完全独立于语言的文本格式,但是也使用了类似于C语言家族的习惯(包括C, C++, C#, Java, ...
- 大致掌握django的功能
目录 静态文件配置 request对象方法初识 pycharm链接数据库(mysql) django链接数据库(mysql) django orm 字段的增删查改 数据的增删查改 数据的查,改,删 d ...
- [设计模式]工厂方法模式(Factory Method)
模式目的 定义一个用于创建对象的接口,让其子类来决定实例化哪个类. 工厂方法模式将类的实例化延迟到了子类中进行. 模式结构 组成部分 产品(Product) - 定义了产品功能的接口 具体产品(Con ...
- es6 模块与commonJS的区别
在刚接触模块化开发的阶段,我总是容易将export.import.require等语法给弄混,今天索性记个笔记,将ES6 模块知识点理清楚 未接触ES6 模块时,模块开发方案常见的有CommonJS. ...
- Github 新玩法 -- Profile ReadMe
Github 新玩法 -- Profile ReadMe Intro 今天刷 Github 的时候偶然发现一个新的玩法,Github Profile ReadMe,可以在个人的 Profile 页面展 ...
- day66 django进阶(2)
目录 一.choices参数(数据库字段设计常见) 二.MTV与MVC模型 三.多对多三种创建方法 1 全自动 2 纯手动 3 半自动 四.AJax 小 一.choices参数(数据库字段设计常见) ...