数据库的insert插入
一开始想使用action操作
但是后来一直报“request available”
后来直接在jsp上进行数据库的插入操作
<form action="lookFriends.jsp" class="smart-form">
<!-- widget content -->
<div class="widget-body no-padding">
<form action="lookFriends.jsp" class="smart-form">
<%
DB mysql = new DB();
String userName = mysql.returnLogin(request);
%>
<fieldset>
<!-- <section>-->
<label class="label">New Book Number</label>
<label class="input">
<input type="text" name="idbookinformation" value="" class="input-sm">
</label>
<!-- </section>-->
<!-- <section>-->
<label class="label">Book ISBN(PK)</label>
<label class="input">
<input type="text" name="ISBNnum" value="" class="input-sm">
</label>
<!-- </section>-->
<!-- <section>-->
<label class="label">Book Title</label>
<label class="input">
<input type="text" name="newbookname" value="" class="input-sm" maxlength="10">
</label>
<!-- </section>-->
<!-- <section>-->
<label class="label">Author ID(FK)</label>
<label class="input">
<input type="text" name="author" value="" class="input-sm">
</label>
<!-- </section>-->
<!-- <section>-->
<label class="label">Publisher</label>
<label class="input">
<input type="text" name="publisher" value="" class="input-sm">
</label>
<!-- </section>-->
<!-- <section>-->
<label class="label">Publish Date</label>
<label class="input">
<input type="text" name="date" value="" class="input-sm">
</label>
<!-- </section>-->
<!-- <section>-->
<label class="label">Price</label>
<label class="input">
<input type="text" name="price" value="" class="input-sm">
</label>
<!-- </section>-->
</fieldset>
<td colspan= "2" align="center">
<input type="submit" value="finish" size="12">
<input type="reset" value="clear" size="12">
</td>
</form>
<%
String newbookname=request.getParameter("newbookname");
String price = request.getParameter("price");
String date = request.getParameter("date");
String author =request.getParameter("author");
String publisher =request.getParameter("publisher");
String ISBN =request.getParameter("ISBNnum");
String Number =request.getParameter("idbookinformation");
System.out.println(ISBN);
//String fri = mysql.insertFri(request, userName, newbookname, price, date, author, publisher,ISBN,Number);
%>
</div>
<!-- widget content -->
<div class="widget-body no-padding">
<form action="lookFriends.jsp" class="smart-form">
<%
//DB mysql = new DB();
// String userName = mysql.returnLogin(request);
%>
<fieldset>
<!-- <section>-->
<label class="label">New Book Number</label>
<label class="input">
<input type="text" name="idbookinformation" value="" class="input-sm">
</label>
<!-- </section>-->
<!-- <section>-->
<label class="label">Book ISBN(PK)</label>
<label class="input">
<input type="text" name="ISBNnum" value="" class="input-sm">
</label>
<!-- </section>-->
<!-- <section>-->
<label class="label">Book Title</label>
<label class="input">
<input type="text" name="newbookname" value="" class="input-sm" maxlength="10">
</label>
<!-- </section>-->
<!-- <section>-->
<label class="label">Author ID(FK)</label>
<label class="input">
<input type="text" name="author" value="" class="input-sm">
</label>
<!-- </section>-->
<!-- <section>-->
<label class="label">Publisher</label>
<label class="input">
<input type="text" name="publisher" value="" class="input-sm">
</label>
<!-- </section>-->
<!-- <section>-->
<label class="label">Publish Date</label>
<label class="input">
<input type="text" name="date" value="" class="input-sm">
</label>
<!-- </section>-->
<!-- <section>-->
<label class="label">Price</label>
<label class="input">
<input type="text" name="price" value="" class="input-sm">
</label>
<!-- </section>-->
</fieldset>
<td colspan= "2" align="center">
<input type="submit" value="finish" size="12">
<input type="reset" value="clear" size="12">
</td>
</form>
</div>
<!-- end widget content -->
<!-- widget content -->
<div class="widget-body no-padding">
<table class="table table-bordered">
<thead>
<tr>
<th>Book Number</th>
<th> ISBN(PK)</th>
<th> Title</th>
<th> Author(ID)</th>
<th> Publisher</th>
<th> PublishDate</th>
<th> Price</th>
</tr>
</thead>
<tbody>
<%
DB mysql = new DB();
String fri;
String userName = mysql.returnLogin(request);
String newbookname=request.getParameter("newbookname");
String price = request.getParameter("Price");
String date = request.getParameter("date");
String author =request.getParameter("author");
String publisher =request.getParameter("publisher");
String ISBN =request.getParameter("ISBNnum");
String Number =request.getParameter("idbookinformation");
System.out.println(ISBN);
if(newbookname != null)
fri = mysql.insertFri(request, userName, newbookname, price, date, author, publisher,ISBN,Number);
DB mysql1 = new DB();
String userName1 = mysql.returnLogin(request);
ResultSet rs = mysql.selectFriAll(request, userName);
String fri1 = mysql.myFriends(request,userName);
ArrayList friends= (ArrayList)session.getAttribute("friends");
System.out.println("1");
if(friends == null|| friends.size() == 0){
%>
<h1>书籍库中未有书籍</h1>
<%
}else{
for(int i=friends.size()-1;i>=0;i--)
{
MyFriBean ff =(MyFriBean)friends.get(i);
%>
<tr>
<th><%=ff.getName()%></th>
<th><%=ff.getISBN()%></th>
<th><%=ff.getName()%></th>
<th><%=ff.getauthor()%></th>
<th><%=ff.getpublisher()%></th>
<th><%=ff.getdate()%></th>
<th><%=ff.getprice()%></th>
</tr>
<%
}
}
%>
</tbody>
</table>
</div>
<!-- end widget content -->
public String insertFri(HttpServletRequest request,String userName,String newBookName,String Price,String Date,String authorid,String publisher,String ISBN,String bookNumber)
{
System.out.println("insert");
try{
String sure = null;
rs = selectFri(request,userName,newBookName);
if(rs.next())
{
sure = "one";
}
else{
String sql ="insert into bookinformation"+" (userName,BookName,ISBN,publisher,Date,Price,Authorid,idbookinformation)"+" values("+"'"+userName+"'"+","+"'"+newBookName+"'"+","+"'"+ISBN+"'"+","+"'"+publisher+"'"+","+"'"+Date+"'"+","+"'"+Price+"'"+","+"'"+authorid+"'"+","+"'"+bookNumber+"'"+")";
st = getStatement();
int row=st.executeUpdate(sql);
if(row==1)
{
//调用myfriend方法,更新session中书籍信息
String fri = myFriends(request,userName);
if(fri.equals("ok"))
{
sure = "ok";
}
else
{
sure = null;
}
}
else
{
sure = null;
}
}
return sure;
}catch(Exception e){
e.printStackTrace();
return null;
}
}
作为一个学Java的,如果没有研究过Netty,那么你对Java语言的使用和理解仅仅停留在表面水平,会点SSH,写几个MVC,访问数据库和缓存,这些只是初等Java程序员干的事。如果你要进阶,想了解Java服务器的深层高阶知识,Netty绝对是一个必须要过的门槛。有了Netty,你可以实现自己的HTTP服务器,FTP服务器,UDP服务器,RPC服务器,WebSocket服务器,Redis的Pr..._netty用来做什么
def classifyPerson(): resultList = ['not at all', 'in small doses', 'in large doses'] #定义结果列表表示3种结果 percentTats = float( input('percentage of time spent playing video games?') ) #输入特征1 f
EasyStreamClient是一套非常稳定、易用、支持重连的StreamClient工具,以SDK形式提供, 接口调用非常简单,经过多年实战和线上运行打造,支持RTMP推送断线重连、环形缓冲、智能丢帧、 网络事件回调;再也不用像调用live555那样处理整个RTSP的复杂流程,担心内存释放的问题了。本文我们讲一讲在EasyStreamClient拉流时,如何利用wireshark分析H.264码流?最近在抓包分析码流的时候,会出现wireshark抓包,抓包只能显示RTP协议,无法看到RTP传的
1.平台:RK32882.系统:Ubuntu 18.04.4 LTS现象:首先这里有两个同样的usb转串口的设备插入系统不同的USB口,然后系统的/dev目录下就会以生成两个ttyUSB*设备,一个是ttyUSB0,一个是ttyUSB1.问题:1.不知道 usb转串口的设备 对应的系统设备名是哪一个?2.生成的设备名可能会变化,可能由于设备插入的先后顺序不一样,导致先插入的设备会生成ttyUSB0,后插入设备就可能是ttyUSB1?解决方法:1.先查找ttyUSB*设备的usb端口号,_ttyxrusb 串口名后移
u-boot分析 二继前一启动篇,此博文目的:学习u-boot的目录结构,从code架构上对u-boot有一个整体的把握和了解。一、学习u-boot,得问,什么是u-boot?u-boot是一段开源的程序。Universal Boot Loader,普遍的引导程序。是非常常用的一个引导程序,可作为主流系统的引导程序,如OpenBSD, NetBSD, FreeBSD,4.4BSD, Linux, S
根据JAVA实体生成SQL建表语句以mysql为例:oracle或SQL Server修改拼接字符串即可。以mysql为例:oracle或SQL Server修改拼接字符串即可。package com.cgd.srm.tools;import lombok.extern.slf4j.Slf4j;import java.io.File;import java.io.FileOutput..._java建表sql
你希望在你的新产品中使用无刷伺服电机吗?平时,我们可能也常碰到一些关键词,例如“梯形波式”,“正弦波式”和“矢量控制”。只有当你了解了他们的真正含义,才能在你的新设计中选择正确的产品。在过去的十年甚至二十年中,伺服电机市场已经从有刷伺服转变成无刷伺服的市场,这主要是由无刷伺服的低维修率和高稳定性所决定的。在这十几年中,驱动部分在电路和系统方面的技术已发展的非常完善。控制方式也已经完全可以实现那些关键词所描述的功能。大部分的高性能的伺服系统都采用一个内部控制环来控制力矩。这个内部..._电机控制入门
mysql中的utf8mb4、utf8mb4_unicode_ci、utf8mb4_general_ci问题:今天在公司项目的日志里面看到了这么一个报错,如下图:这问题一看就是编码的问题,怎么产生的呢?1、可能用户有添加emoji的表情2、MySQL 的 utf8 并不是真正的 utf8解决方法当然是把数据库该字段的编码格式改成utf8mb4到底utf8和utf8mb4有什么区别呢?..._utf8mb4_unicode_ci和utf8mb4区别
Hadoop启动报Error: JAVA_HOME is not set and could not be found解决办法 Hadoop安装完后,启动时报Error: JAVA_HOME is not set and could not be found.解决办法: 修改/etc/hadoop/hadoop-env.sh中设JAVA_HO
C语言的strcpy()和strncpy()函数strcpy()函数strcpy() 函数用来复制字符串,其原型为: char *strcpy(char *dest, const char *src);【参数】dest 为目标字符串指针,src 为源字符串指针。注意:src 和 dest 所指的内存区域不能重叠,且 dest 必须有足够的空间放置 src 所包含的字符串(包含结束符NULL)。【返回值】成功执行后返回目标数组指针 dest。strcpy() 把src所指的由NULL结_strcpy函数用法
一、 Name命名1. 命名长度对程序性能没有影响,尽可能使用清淅明了的单词组合,避免使用不常用的缩写或自定义的缩写。2. ClassFile1) UpperCamelCase.cs2) 单词选用倾向于名词3) ClassFileName与ClassName同名,命名规则相同。3.
出版商:贝哲斯咨询获取报告样本:企业竞争态势 该报告涉及的主要国际市场参与者有Catalytic Materials、Chasm Technologies、Hybrid Plastics、Hyperion Catalysis International、Integran Technologies、NanoMaterials Technology、Nanocyl、Nanophase Technologies、Nanosys、PEN、Quantum Sphere、Shenzhen Nanot...