⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 70689239cbab001d1412e7a87039532d

📁 项目名叫网上图书馆
💻
字号:
<%@ page language="java" pageEncoding="gbk" import="java.sql.*" import="java.util.*" import="org.apache.struts.upload.FormFile"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> 
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
 <jsp:useBean id="data" class="com.hua.book.struts.datebase.Database" scope="session"/>
<jsp:useBean id="smart" scope="page" class="org.lxh.smart.SmartUpload"/>
<%
	// 1、上传初始化
	smart.initialize(pageContext) ;
	// 2、准备上传
	smart.upload() ;
	// 3、保存上传的文件
	String filename=smart.getFiles().getFile(0).getFileName();
	String filepath=request.getRealPath("/")+"load\\";
	String mm=request.getRealPath("/");
	 smart.save(filepath) ;
	String src=smart.getFiles().getFile(0).getFilePathName();
	
	
	
	
	GregorianCalendar calendar = new GregorianCalendar();
		int year = calendar.get(Calendar.YEAR);
		int month = calendar.get(Calendar.MONTH) + 1;
		int day = calendar.get(Calendar.DAY_OF_MONTH);
		String uploadtime = year + "-" + month + "-" + day;
		
		String bookid=smart.getRequest().getParameter("bookid");
	 	String bookname=smart.getRequest().getParameter("bookname");
		String bookauthor=smart.getRequest().getParameter("bookauthor");
		String biglocation=smart.getRequest().getParameter("biglocation");
		String smalllocation=smart.getRequest().getParameter("smalllocation");
		String bookinprice=smart.getRequest().getParameter("bookinprice");
		String bookshuliang=smart.getRequest().getParameter("bookshuliang");
		String bookshuoming=smart.getRequest().getParameter("bookshuoming");
		String bookchubanshe=smart.getRequest().getParameter("bookchubanshe");
		String bookborrowprice=smart.getRequest().getParameter("bookborrowprice");
	boolean checkbookid=data.getbookid("bookid");
	if(checkbookid)
	{
		%>
			<script language="javascript">
			alert('对不起!已存在此图书编号!请重新添加!');
			window.location="adminadd.jsp";
			</script>
		<%
	}
	else
	{
		boolean tag=data.adminbookadd(bookid,bookname, bookauthor, biglocation,smalllocation, bookshuliang, bookchubanshe, bookinprice, bookshuoming, filename,uploadtime,bookborrowprice);	
		if(tag)
		{
		
		%>
		<script language="javascript">
		//<!--
			alert("恭喜你!添加成功!");
			window.location="adminadd.jsp";
		//-->
		</script>
		<%
		}
		else
		{
		%>
		<script language="javascript">
		<!--
			alert("对不起!添加失败!");
			window.location="adminadd.jsp";
		//-->
		</script>
		<%
		}
	}
	
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -