diff --git a/src/BookOperation/UploadServlet.java b/src/BookOperation/UploadServlet.java new file mode 100644 index 0000000..645013e --- /dev/null +++ b/src/BookOperation/UploadServlet.java @@ -0,0 +1,60 @@ +package BookOperation; + +import Connect.Connect; +import JaveBean.Book; +import org.hibernate.Session; +import org.hibernate.Transaction; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class UploadServlet extends HttpServlet { + private Connect con = Connect.getCon(); + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + request.setCharacterEncoding("gb2312"); + response.setContentType("text/html;charset=utf-8"); + + String bookname=request.getParameter("bookname"); + String category=request.getParameter("category"); + double price= Double.parseDouble(request.getParameter("price")); + System.out.println(bookname); + System.out.println(category); + System.out.println(price); + + Session hSession=Connect.getConfig(); + Transaction tx=hSession.beginTransaction(); + //String hql = "FROM User WHERE username=:name"; + //Query query = hSession.createQuery(hql); + //query.setParameter("name",name); + //List results = query.list(); + + shangchuan(bookname,hSession,category,price); + + tx.commit(); +// User user= (User) results.get(0); + + System.out.println("上传成功"); + } + + public void shangchuan(String bookname, Session session, String category, double price){ + Book book = new Book(); + //book.setBookid(7); + book.setBookname(bookname); + book.setPrice(price); + book.setCategory(category); + book.setImageurl("cbsdaka"); + book.setSellerId(1); + session.save(book);//保存对象进入数据库 + } +} + + + + + + + diff --git a/web/WEB-INF/lib/FastInfoset-1.2.15.jar b/web/WEB-INF/lib/FastInfoset-1.2.15.jar new file mode 100644 index 0000000..2671209 Binary files /dev/null and b/web/WEB-INF/lib/FastInfoset-1.2.15.jar differ diff --git a/web/WEB-INF/lib/antlr-2.7.7.jar b/web/WEB-INF/lib/antlr-2.7.7.jar new file mode 100644 index 0000000..5e5f14b Binary files /dev/null and b/web/WEB-INF/lib/antlr-2.7.7.jar differ diff --git a/web/WEB-INF/lib/byte-buddy-1.10.2.jar b/web/WEB-INF/lib/byte-buddy-1.10.2.jar new file mode 100644 index 0000000..b04187b Binary files /dev/null and b/web/WEB-INF/lib/byte-buddy-1.10.2.jar differ diff --git a/web/WEB-INF/lib/classmate-1.5.1.jar b/web/WEB-INF/lib/classmate-1.5.1.jar new file mode 100644 index 0000000..819f5ea Binary files /dev/null and b/web/WEB-INF/lib/classmate-1.5.1.jar differ diff --git a/web/WEB-INF/lib/dom4j-2.1.1.jar b/web/WEB-INF/lib/dom4j-2.1.1.jar new file mode 100644 index 0000000..cda47db Binary files /dev/null and b/web/WEB-INF/lib/dom4j-2.1.1.jar differ diff --git a/web/WEB-INF/lib/hibernate-commons-annotations-5.1.0.Final.jar b/web/WEB-INF/lib/hibernate-commons-annotations-5.1.0.Final.jar new file mode 100644 index 0000000..9a9d5b7 Binary files /dev/null and b/web/WEB-INF/lib/hibernate-commons-annotations-5.1.0.Final.jar differ diff --git a/web/WEB-INF/lib/hibernate-core-5.4.9.Final.jar b/web/WEB-INF/lib/hibernate-core-5.4.9.Final.jar new file mode 100644 index 0000000..91a2062 Binary files /dev/null and b/web/WEB-INF/lib/hibernate-core-5.4.9.Final.jar differ diff --git a/web/WEB-INF/lib/istack-commons-runtime-3.0.7.jar b/web/WEB-INF/lib/istack-commons-runtime-3.0.7.jar new file mode 100644 index 0000000..2fe5b82 Binary files /dev/null and b/web/WEB-INF/lib/istack-commons-runtime-3.0.7.jar differ diff --git a/web/WEB-INF/lib/jandex-2.1.1.Final.jar b/web/WEB-INF/lib/jandex-2.1.1.Final.jar new file mode 100644 index 0000000..4162ece Binary files /dev/null and b/web/WEB-INF/lib/jandex-2.1.1.Final.jar differ diff --git a/web/WEB-INF/lib/javassist-3.24.0-GA.jar b/web/WEB-INF/lib/javassist-3.24.0-GA.jar new file mode 100644 index 0000000..977a081 Binary files /dev/null and b/web/WEB-INF/lib/javassist-3.24.0-GA.jar differ diff --git a/web/WEB-INF/lib/javax.activation-api-1.2.0.jar b/web/WEB-INF/lib/javax.activation-api-1.2.0.jar new file mode 100644 index 0000000..986c365 Binary files /dev/null and b/web/WEB-INF/lib/javax.activation-api-1.2.0.jar differ diff --git a/web/WEB-INF/lib/javax.persistence-api-2.2.jar b/web/WEB-INF/lib/javax.persistence-api-2.2.jar new file mode 100644 index 0000000..164ef3a Binary files /dev/null and b/web/WEB-INF/lib/javax.persistence-api-2.2.jar differ diff --git a/web/WEB-INF/lib/jaxb-api-2.3.1.jar b/web/WEB-INF/lib/jaxb-api-2.3.1.jar new file mode 100644 index 0000000..4565865 Binary files /dev/null and b/web/WEB-INF/lib/jaxb-api-2.3.1.jar differ diff --git a/web/WEB-INF/lib/jaxb-runtime-2.3.1.jar b/web/WEB-INF/lib/jaxb-runtime-2.3.1.jar new file mode 100644 index 0000000..0b9ef67 Binary files /dev/null and b/web/WEB-INF/lib/jaxb-runtime-2.3.1.jar differ diff --git a/web/WEB-INF/lib/jboss-logging-3.3.2.Final.jar b/web/WEB-INF/lib/jboss-logging-3.3.2.Final.jar new file mode 100644 index 0000000..67cde71 Binary files /dev/null and b/web/WEB-INF/lib/jboss-logging-3.3.2.Final.jar differ diff --git a/web/WEB-INF/lib/jboss-transaction-api_1.2_spec-1.1.1.Final.jar b/web/WEB-INF/lib/jboss-transaction-api_1.2_spec-1.1.1.Final.jar new file mode 100644 index 0000000..627f7ce Binary files /dev/null and b/web/WEB-INF/lib/jboss-transaction-api_1.2_spec-1.1.1.Final.jar differ diff --git a/web/WEB-INF/lib/stax-ex-1.8.jar b/web/WEB-INF/lib/stax-ex-1.8.jar new file mode 100644 index 0000000..5e60637 Binary files /dev/null and b/web/WEB-INF/lib/stax-ex-1.8.jar differ diff --git a/web/WEB-INF/lib/txw2-2.3.1.jar b/web/WEB-INF/lib/txw2-2.3.1.jar new file mode 100644 index 0000000..75ed519 Binary files /dev/null and b/web/WEB-INF/lib/txw2-2.3.1.jar differ diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml index bf6e93c..631da46 100644 --- a/web/WEB-INF/web.xml +++ b/web/WEB-INF/web.xml @@ -4,15 +4,51 @@ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version="4.0"> + + This is the description of my J2EE component + This is the display name of my J2EE component + RegisterServlet + Register.RegisterServlet + + + This is the description of my J2EE component + This is the display name of my J2EE component + LoginServlet + Register.LoginServlet + This is the description of my J2EE component This is the display name of my J2EE component UploadServlet - test.UploadServlet + BookOperation.UploadServlet + + + This is the description of my J2EE component + This is the display name of my J2EE component + ShopCartServlet + ShopCar.ShopCartServlet - + + RegisterServlet + /register.action + UploadServlet - /Upload.action + /upload.action + + + LoginServlet + /login.action + + + ShopCartServlet + *.do + + + ShopCartServlet + /ShopCartServlet + + huiyuan.html + \ No newline at end of file