資源簡介
這是一個基于jsp開發的在線手機銷售系統,里面應用了css,js等技術,可供大家學習和參考。程序中不存在基本錯誤,大家可以放心使用。

代碼片段和文件信息
package?product;
import?java.io.IOException;
import?java.sql.Connection;
import?java.sql.PreparedStatement;
import?java.sql.ResultSet;
import?java.sql.SQLException;
import?java.util.ArrayList;
import?java.util.Date;
import?javax.servlet.ServletException;
import?javax.servlet.http.HttpServlet;
import?javax.servlet.http.HttpServletRequest;
import?javax.servlet.http.HttpServletResponse;
import?com.jspsmart.upload.SmartUpload;
import?com.jspsmart.upload.SmartUploadException;
import?util.DBUtil;
public?class?AddTellphone??extends?HttpServlet{
@SuppressWarnings(“deprecation“)
protected?void?doPost(HttpServletRequest?request
HttpServletResponse?response)?throws?ServletException?IOException?{
try?{
???? SmartUpload?s=new?SmartUpload();
s.initialize(getServletConfig()?request?response);
try?{
s.upload();
s.save(“/upload“);
}?catch?(SmartUploadException?e)?{
e.printStackTrace();
}
Connection?conn?=?DBUtil.getConnection();?
int?id0=Integer.parseInt(s.getRequest().getParameter(“type“));
ResultSet?rs=null;
????????PreparedStatement?pw=null;
???? String?sql=““;
????????sql=“select??name?from?producttype“;
????????pw=conn.prepareStatement(sql);
????????rs=pw.executeQuery();
????????ArrayList?a=new?ArrayList();
????????while(rs.next()){
????????????String?str=rs.getString(“name“);
??????????????a.add(str);
????????}
????????String?name=(String)a.get(id0);
????????sql=“select??producttypeid?from?producttype?where?name=?“;
????????pw=conn.prepareStatement(sql);
????????pw.setString(1name);
????????rs=pw.executeQuery();
????????rs.next();
????????int?id?=rs.getInt(“producttypeid“);
????????????
????????sql=“insert?into??protuct?values?(??????????)“;
?? ????????pw=conn.prepareStatement(sql);
?? ?? ???
?? ???
?? ???? pw.setString(1?s.getRequest().getParameter(“name“));
???? pw.setInt(2?id);
???? pw.setString(3?s.getRequest().getParameter(“introduce“));
???? pw.setString(4?s.getRequest().getParameter(“remark“));
???? pw.setString(5?s.getRequest().getParameter(“Marketprice“));
???? pw.setString(6?s.getRequest().getParameter(“Memberprice“));
???? pw.setString(7?s.getFiles().getFile(0).getFileName());
???? pw.setInt(80);
???? pw.setInt(12Integer.parseInt(s.getRequest().getParameter(“num“)));
???? pw.setInt(90);
???? pw.setInt(100);
???? pw.setString(11?new?Date().toLocaleString());
???? pw.executeUpdate();
???? pw.close();
???? conn.close();
???? response.sendRedirect(“AddTellphone.jsp“);
}?catch?(SQLException?e)?{
//?TODO?Auto-generated?catch?block
e.printStackTrace();
}
}
protected?void?doGet(HttpServletRequest?arg0?HttpServletResponse?arg1)
throws?ServletException?IOException?{
//?TODO?Auto-generated?method?stub
doPost(arg0?arg1);
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????4648??2013-06-09?08:26??程序\sql.txt
?????文件????3145728??2013-06-08?15:02??程序\tellphoneshop.mdf
?????文件????????401??2013-05-15?15:54??程序\WebShop\.classpath
?????文件????????302??2013-05-10?22:40??程序\WebShop\.myme
?????文件???????1413??2010-03-22?16:34??程序\WebShop\.project
?????文件????????399??2010-03-22?16:34??程序\WebShop\.settings\.jsdtscope
?????文件?????????49??2010-03-22?16:34??程序\WebShop\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件??????????6??2010-03-22?16:34??程序\WebShop\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????文件???????2957??2013-05-19?23:25??程序\WebShop\Addproducttype.jsp
?????文件???????5915??2013-05-19?23:02??程序\WebShop\AddTellphone.jsp
?????文件???????2461??2013-05-12?19:47??程序\WebShop\AdminLogin.jsp
?????文件??????17101??2013-05-21?17:09??程序\WebShop\adminOrderInfo.jsp
?????文件???????3073??2013-05-15?13:20??程序\WebShop\AdminRegister.jsp
?????文件???????8348??2013-05-24?23:22??程序\WebShop\cart.jsp
?????文件???????2447??2013-05-17?23:37??程序\WebShop\center.jsp
?????文件???????8489??2013-05-24?23:26??程序\WebShop\checkOrder.jsp
?????文件??????12662??2009-10-16?14:27??程序\WebShop\css\1.css
?????文件???????4372??2009-10-16?14:27??程序\WebShop\css\calendar.css
?????文件???????2411??2007-09-10?23:25??程序\WebShop\css\displaytag.css
?????文件????????795??2009-10-16?14:27??程序\WebShop\css\dtree.css
?????文件?????????24??2009-10-16?14:27??程序\WebShop\css\font.css
?????文件???????7700??2009-10-16?14:27??程序\WebShop\css\info.css
?????文件???????3756??2009-10-16?14:27??程序\WebShop\css\mycss.css
?????文件??????11675??2009-10-16?14:27??程序\WebShop\css\st
?????文件???????7919??2009-10-16?14:27??程序\WebShop\css\st
?????文件???????5935??2007-09-11?22:13??程序\WebShop\css\st
?????文件???????3293??2013-05-14?23:57??程序\WebShop\FindPassword.jsp
?????文件???????1091??2013-05-17?22:59??程序\WebShop\foot.jsp
?????文件???????9741??2013-06-03?20:47??程序\WebShop\hotproduct.jsp
?????文件????????587??2009-10-16?14:22??程序\WebShop\images\0-1.gif
............此處省略587個文件信息
評論
共有 條評論