📄 addbooks_0002ejsp_jsp.java
字号:
import javax.swing.*;
import bookshoppingsys.BookDetails;
import java.sql.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;
public class AddBooks_0002ejsp_jsp extends HttpJspBase {
// begin [file="/AddBooks.jsp";from=(7,4);to=(7,83)]
// end
static {
}
public AddBooks_0002ejsp_jsp( ) {
}
private static boolean _jspx_inited = false;
public final void _jspx_init() throws org.apache.jasper.runtime.JspException {
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
String _value = null;
try {
if (_jspx_inited == false) {
synchronized (this) {
if (_jspx_inited == false) {
_jspx_init();
_jspx_inited = true;
}
}
}
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html; charset=GBK");
pageContext = _jspxFactory.getPageContext(this, request, response,
"", true, 8192, true);
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
// HTML // begin [file="/AddBooks.jsp";from=(0,48);to=(1,0)]
out.write("\r\n");
// end
// HTML // begin [file="/AddBooks.jsp";from=(1,34);to=(2,0)]
out.write("\r\n");
// end
// HTML // begin [file="/AddBooks.jsp";from=(2,46);to=(3,0)]
out.write("\r\n");
// end
// HTML // begin [file="/AddBooks.jsp";from=(3,30);to=(4,0)]
out.write("\r\n");
// end
// HTML // begin [file="/AddBooks.jsp";from=(4,31);to=(5,0)]
out.write("\r\n");
// end
// begin [file="/AddBooks.jsp";from=(5,2);to=(5,38)]
request.setCharacterEncoding("GBK");
// end
// HTML // begin [file="/AddBooks.jsp";from=(5,40);to=(7,4)]
out.write("\r\n<html>\r\n<!--");
// end
// begin [file="/AddBooks.jsp";from=(7,4);to=(7,83)]
bookshoppingsys.BookDetails bookInf = null;
boolean _jspx_specialbookInf = false;
synchronized (session) {
bookInf= (bookshoppingsys.BookDetails)
pageContext.getAttribute("bookInf",PageContext.SESSION_SCOPE);
if ( bookInf == null ) {
_jspx_specialbookInf = true;
try {
bookInf = (bookshoppingsys.BookDetails) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "bookshoppingsys.BookDetails");
} catch (ClassNotFoundException exc) {
throw new InstantiationException(exc.getMessage());
} catch (Exception exc) {
throw new ServletException (" Cannot create bean of class "+"bookshoppingsys.BookDetails", exc);
}
pageContext.setAttribute("bookInf", bookInf, PageContext.SESSION_SCOPE);
}
}
if(_jspx_specialbookInf == true) {
// end
// begin [file="/AddBooks.jsp";from=(7,4);to=(7,83)]
}
// end
// HTML // begin [file="/AddBooks.jsp";from=(7,83);to=(8,0)]
out.write("\r\n");
// end
// begin [file="/AddBooks.jsp";from=(8,0);to=(8,46)]
JspRuntimeLibrary.introspect(pageContext.findAttribute("bookInf"), request);
// end
// HTML // begin [file="/AddBooks.jsp";from=(8,46);to=(10,0)]
out.write("-->\r\n<body bgcolor=\"#ffffff\">\r\n");
// end
// begin [file="/AddBooks.jsp";from=(10,2);to=(45,0)]
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ;
Connection con=DriverManager.getConnection("jdbc:odbc:Shopping");
Statement stmt=con.createStatement();
//PreparedStatement ps=null;
String type;String name;String author;
String publisher;String description; float price ;float tvalue;
float vvalue; int salenumber;String images;
type=(String)request.getParameter("book_type");
name=(String)request.getParameter("book_name") ;
author=(String)request.getParameter("author") ;
publisher=(String)request.getParameter("publishing_house") ;
description=(String)request.getParameter("description");
String pri=request.getParameter("value");
price=Float.parseFloat(pri);
String tv=request.getParameter("T_value");
tvalue=Float.parseFloat(tv) ;
String vv=request.getParameter("vip_value");
vvalue=Float.parseFloat(vv) ;
salenumber=Integer.parseInt(request.getParameter("sale_number"));
images=(String)request.getParameter("book_image");
stmt.executeUpdate("insert into book values('"+type+"','"+name+"','"+author+"','"+publisher+"','"+description+"','"+price+"','"+tvalue+"','"+vvalue+"','"+salenumber+"','"+images+"')");
//ps=con.prepareStatement("insert into book values('"+type+"','"+name+"','"+author+"','"+publisher+"','"+description+"','"+price+"','"+tvalue+"','"+vvalue+"','"+salenumber+"','"+images+"')");
//ps.setString(2,type);
//ps.setString(3,name);
// ps.setString(4,author);
//ps.setString(5,publisher);
//ps.setString(6,description);
//ps.setFloat(7,price);
//ps.setFloat(8,tvalue);
//ps.setFloat(9,vvalue);
//ps.setInt(10,salenumber);
//ps.setString(11,images);
//ps.executeUpdate();
// end
// HTML // begin [file="/AddBooks.jsp";from=(45,2);to=(46,0)]
out.write("\r\n");
// end
// begin [file="/AddBooks.jsp";from=(46,0);to=(46,36)]
if (true) {
out.clear();
String _jspx_qfStr = "";
pageContext.forward("addSuccess.jsp" + _jspx_qfStr);
return;
}
// end
// HTML // begin [file="/AddBooks.jsp";from=(46,36);to=(47,0)]
out.write("\r\n");
// end
// begin [file="/AddBooks.jsp";from=(47,2);to=(50,0)]
}catch(Exception e)
{ out.println(e);}
// end
// HTML // begin [file="/AddBooks.jsp";from=(50,2);to=(53,0)]
out.write("\r\n</body>\r\n</html>\r\n");
// end
} catch (Throwable t) {
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (pageContext != null) pageContext.handlePageException(t);
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -