📄 bookupdate.jsp
字号:
<%@ page contentType="text/html; charset=GBK" %>
<jsp:useBean id="mybook" scope="page" class="bookshop.BookInfoBean"/>
<jsp:useBean id="bookclass" scope="page" class="bookshop.BookClassBean"/>
<%
int dd=0;
String action =request.getParameter("action");
if(action.equals("del"))//添加
{
String bookid= request.getParameter("bookid");
int id=Integer.parseInt(bookid);
String str="delete bookinformation where bookid="+id;
dd= mybook.updateBook(str);
}
if(action.equals("add"))//添加
{
String bookname= request.getParameter("bookname");
String bookclassno= request.getParameter("bookclassno");
int classid= bookclass.getClassId(bookclassno);//得到类Id
String author= request.getParameter("author");
String publish= request.getParameter("publish");
String price= request.getParameter("price");//
float myprice=Float.parseFloat(price);
String agioprice= request.getParameter("agioprice");//
float myagioprice=Float.parseFloat(price);
String amount= request.getParameter("amount");//
int am= Integer.parseInt(amount);
String leav_number= request.getParameter("leav_number");//
int leav= Integer.parseInt(leav_number);
String booktext= request.getParameter("booktext");//
String hotbook= request.getParameter("hotbook");//
String picture= request.getParameter("picture");//
String context= request.getParameter("txtcontext");//
int ii=picture.lastIndexOf('\\');
String pp="pic/"+picture.substring(ii+1);
String str="insert into bookinformation(bookname,bookclassno,author,publish,price,agioprice,amount,leav_number,regtime,booktext,hotbook,picture,content)values('"+
bookname+"',"+classid+",'"+author+"','"+publish+"',"+myprice+","+myagioprice+","+am+","+leav+",getdate()"+",'"+booktext+"','"+hotbook+"','"+pp+"','"+context+"')";
dd =mybook.updateBook(str);
}
if(action.equals("update"))//添加
{
String bookname= request.getParameter("bookname");
String bookclassno= request.getParameter("bookclassno");
// int classid= bookclass.getClassId(bookclassno);
int classid= bookclass.getClassId(bookclassno);//得到类Id
String author= request.getParameter("author");
String publish= request.getParameter("publish");
String price= request.getParameter("price");//
float myprice=Float.parseFloat(price);
String agioprice= request.getParameter("agioprice");//
float myagioprice=Float.parseFloat(price);
String amount= request.getParameter("amount");//
int am= Integer.parseInt(amount);
String leav_number= request.getParameter("leav_number");//
int leav= Integer.parseInt(leav_number);
String booktext= request.getParameter("booktext");//
String hotbook= request.getParameter("hotbook");//
String picture= request.getParameter("picture");//
String context= request.getParameter("txtcontext");//
int ii=picture.lastIndexOf('\\');
String pp="pic/"+picture.substring(ii+1);
String bookid= request.getParameter("bookid");
int id=Integer.parseInt(bookid);
String str="update bookinformation set bookname ='"+bookname+"',bookclassno='"+classid+"',author='"+author+"',publish='"+
publish+"',price='"+price+"',agioprice='"+agioprice+"',amount='"+amount+"',leav_number='"+leav_number+"',booktext='"+booktext+
"',hotbook='"+hotbook+"',picture='"+pp+"',content='"+context +"' where bookid="+id;
dd =mybook.updateBook(str);
}
%>
<script type="">
alert("图书信息更新成功!");
location.href="admin_main.jsp";
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -