freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

電子商務(wù)手機銷售網(wǎng)站畢業(yè)設(shè)計論文-全文預(yù)覽

2024-12-31 15:24 上一頁面

下一頁面
  

【正文】 m product where id id stmt DBgetStatement conn 使用 Statement 對象接收 sql 語句 DBexecuteUpdate stmt sql 執(zhí)行 sql 語句 finally DBclose stmt DBclose conn 關(guān)閉連接 getProducts List products int pageNo int pageSize boolean lazy 獲取商品列表分頁顯示方法此方法有 4個參數(shù)第一個參數(shù)是 List 集合第二個參數(shù)是第幾頁第三個參數(shù)是每頁顯示多少條第四個參數(shù)是是否初始化對象模擬hiber public List getProducts Connection conn DBgetConn 獲得連接 Statement stmt DBgetStatement conn String sql select from product order by pdate desc ResultSet rs DBgetResultSet stmt sql 使用 ResultSet 對象接收返回結(jié)果集 List products new ArrayList try while rsnext 遍歷獲得的結(jié)果集 Product p getProductFromRs rs productsadd p 添加到一個 List 集合中 catch SQLException e eprintStackTrace finally DBclose stmt DBclose rs DBclose conn return products 返回 List 集合 實現(xiàn)效果如下 圖 47 產(chǎn)品列表 update 方法通過傳入 id 值來修改用戶的信息 SQL 語句是使用 update product set name descr normalprice memberprice categoryid where id Delete 0 方法和 loadById 方法類似 public void update Product p Connection conn null PreparedStatement pstmt null try conn DBgetConn 獲取數(shù)據(jù)庫連接 String sql update product set name descr normalprice memberprice categoryid where id pstmt DBprepare conn sql pstmtsetString 1 pgetName 設(shè)置的值 pstmtsetString 2 pgetDescr pstmtsetDouble 3 pgetNormalPrice pstmtsetDouble 4 pgetMemberPrice pstmtsetInt 5 pgetCategoryId pstmtsetInt 6 pgetId pstmtexecuteUpdate catch SQLException e eprintStackTrace finally DBclose pstmt DBclose conn find 訪法產(chǎn)品搜索產(chǎn)品的復(fù)雜搜索 產(chǎn)品的復(fù)雜搜索首先用到了一個輔助對象表單對象ProductSearchFormBeanjava 這個類中有以下這些屬性 1 private int categoryId 類型 ID 2 private String name 商品名 3 private double lowNormalPrice 最低市場價格 4 private double highNormalPrice 最高市場價格 5 private double lowMemberPrice 最低會員價格 6 private double highMemberPrice 最高會員價格 7 private String startDate 開始日期 8 private String endDate 結(jié)束日期 ComplexSerchResult 初始化 searchBean page language java import javautil contentType texthtmlcharset gbk pageEncoding GB18030 page import bjsxtshoppingproduct jspuseBean id searchBean class bjsxtshoppingproductProductSearchFormBean jspsetProperty name searchBean property jspuseBean Data Transfer Object 驗證 jspgetProperty name searchBean property categoryId nbsp jspgetProperty name searchBean property name nbsp jspgetProperty name searchBean property lowNormalPrice nbsp jspgetProperty name searchBean property highNormalPrice nbsp jspgetProperty name searchBean property lowMemberPrice nbsp jspgetProperty name searchBean property highMemberPrice nbsp jspgetProperty name searchBean property startDate nbsp jspgetProperty name searchBean property endDate nbsp 接下來在 find 方法中拼湊了一段完整的 sql語句查詢方法可以通過類別產(chǎn)品價格區(qū)間產(chǎn)品 ID 產(chǎn)品名來匹配查找方法的代碼如下 public int find List products int pageNo int pageSize ProductSearchFormBean bean 拿到 searchBean String queryStr where 1 1 where 1 1 為了 and 添加方便 if beangetCategoryId 1 queryStr and pcategoryid beangetCategoryId if beangetName null beangetName trim equals queryStr and pname like beangetName if beangetLowNormalPrice 00 queryStr and pnormalprice beangetLowNormalPrice if beangetHighNormalPrice 00 queryStr and pnormalprice beangetHighNormalPrice if beangetLowMemberPrice 00 queryStr and pmemberprice beangetLowMemberPrice if beangetHighMemberPrice 00 queryStr and pmemberprice beangetHighMemberPrice if beangetStartDate null beangetStartDate trim equals queryStr and ppdate beangetStartDate 000000 if beangetEndDate null beangetEndDate trim equals queryStr and ppdate beangetEndDate 000000 最后合成一條完整的 sql 語句 queryStr 傳送給 dao 層 return daofind products pageNo pageSize queryStr 實現(xiàn)效果如下 圖 48 商品檢索 434 產(chǎn)品模塊前端 Indexjsp中的生成動態(tài)產(chǎn)品類別效果首先要取得所有的 Category然后從其中取出級別最高的 Category 也就是第一級的種類目錄 private List getTopCategories List categories List topCategories new ArrayList for int i 0 i categoriessize i Category c categoriesget i if cgetGrade 1 topCategoriesadd c return topCategories private List getChilds Category parent List categories List childs new ArrayList for int i 0 i categoriessize i Category c categoriesget i if cgetPid parentgetId childsadd c return childs private String getChildsStr List childs StringBuffer buf new StringBuffer for int i 0 i childssize i Category c childsget i bufappend a href ShowProductsjspcategoryId cgetId append cgetName append append return buftoString 拿所有的種類 List categories CategoryServicegetInstance getCategories 拿到最頂層目錄第一級的目錄 List topCategories getTopCategories categories 然后通過以下代碼并排顯示到頁面中 for int i 0 i topCategoriessize i Category c topCategoriesget i a href onMouseOver on_trview cgetId in img src images00gif name Image0 border 0 span style colorFFFFFF cgetName 其中用到的 on_trview 為 function on_trview trnameenforce for int i 0 i topCategoriessize i Category c topCategoriesget i documentallpma_ cgetId styledisplay none 而其中的 pma_ cgetId 來源與 for int
點擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1