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

正文內(nèi)容

網(wǎng)上圖書銷售系統(tǒng)課程設(shè)計報告(已改無錯字)

2023-02-18 23:50:18 本頁面
  

【正文】 Server 2022 數(shù)據(jù)庫驅(qū)動String url =jdbc:microsoft://保存連接數(shù)據(jù)庫的 URL 地址的變量conn=(url,”sa”,””)。//建立數(shù)據(jù) 庫連接Statement stmt= ()。 }catch(Exception ee){ (connect db error:+())。//檢測數(shù)據(jù)庫連接是否成功 return false。 } return true。 } public static void main(String[] args) { try{ DataBase db = new DataBase()。 ()。 }catch(Exception e){ 信息工程系 計網(wǎng)班第 17 頁 共 50 頁 ()。 } }}(2)字符處理 Bean 的編寫在 JSP 開發(fā)中經(jīng)常會涉及有關(guān)字符串的處理,例如:把字符串轉(zhuǎn)換成適合于網(wǎng)頁顯示的文本、八字符串轉(zhuǎn)換成適合 SQL 語句的字符串等等,所以把 這些字符串 處理方法集中到一個類中。 這也是一個公共類[3] 。關(guān)鍵代碼如下:package 。/** * p負(fù)責(zé) 字符串的處理 /p */import .*。import .*。public class dataFormat { public dataFormat() { } /** * 把字符串轉(zhuǎn)換成適合于網(wǎng)頁顯示的文本 * @param s * @return */ public static String toHtml(String s) { if (s==null) return s。 s=strReplace(s,amp。,amp。)。 s=strReplace(s,)。 s=strReplace(s,)。 s=strReplace(s,\,)。 s=parseReturn(s,br\n )。 return s。 信息工程系 計網(wǎng)班第 18 頁 共 50 頁 } /** * 把字符串sBody中的sFrom用sTo替換 * @param sBody * @param sFrom * @param sTo * @return */ public static String strReplace(String sBody, String sFrom, String sTo) { int i,j,k,l。 if (sBody==null || ()) return 。 i = 0。 j = ()。 k = ()。 StringBuffer sss = new StringBuffer(())。 boolean bFirst=true。 l = i。 while ((sFrom,i)!=1) { i = (sFrom,i)。 ((l,i))。 (sTo)。 i += j。 l = i。 } ((l))。 return ()。 } /** * 把字符串中的\r\n轉(zhuǎn)換成\n * @param String sBody : 要進(jìn)行替換操作的字符串 * @param String sEndwith : 要替換成為的字符串 信息工程系 計網(wǎng)班第 19 頁 共 50 頁 */ public static String parseReturn(String sBody, String sEndwith) { StringTokenizer t = new StringTokenizer(sBody, \r\n)。 StringBuffer sss = new StringBuffer(())。 boolean bFirst=true。 if (().equals()) sEndwith=\n。 while (()) { String s=()。 s=()。 while (( )) s=(2)。 if (!()) { if (bFirst) { bFirst=false。 } else { (sEndwith)。 } (s)。 } } return ()。 } /** * 將字符串格式化成 HTML 代碼輸出 * 只轉(zhuǎn)換特殊字符,適合于 HTML 中的表單區(qū)域 * @param str 要格式化的字符串 * @return 格式化后的字符串 */ public static String toHtmlInput(String str) { if (str == null) return null。 String html = new String(str)。 html = strReplace(html, amp。, amp。)。 信息工程系 計網(wǎng)班第 20 頁 共 50 頁 html = strReplace(html, , )。 html = strReplace(html, , )。 return html。 } /** * 將普通字符串格式化成數(shù)據(jù)庫認(rèn)可的字符串格式 * * @param str 要格式化的字符串 * @return 合法的數(shù)據(jù)庫 字符串 */ public static String toSql(String str) { String sql = new String(str)。 return strReplace(sql, 39。, 39。39。)。 }}(3)實現(xiàn)圖書分類實體 Bean這個類是對圖書分類實體的抽象,他包含了 圖書分類實體的所有屬性及 圖書分類對象的初始化構(gòu)造方法,它的屬性和表Bookclass對應(yīng),部分代 碼如下:package 。/** * p圖書 分類類/p */public class bookclass { private int Id。 //ID序列號 private String ClassName。 //圖書類別 public bookclass() { Id = 0。 ClassName = 。 } public bookclass(int newId, String newname) { Id = newId。 信息工程系 計網(wǎng)班第 21 頁 共 50 頁 ClassName = newname。 }……(4)實現(xiàn)訂單實體 Bean這個類是對訂單實體的抽象,它包含了 訂單實體的所有屬性及 訂單對象的初始化構(gòu)造方法??蛻裘看钨徺I一種商品都會產(chǎn)生一次訂購單,它包括 訂單號,所購買的書號,所購買這種書的數(shù)量等,這些構(gòu)成了這個類的私有屬性, 這些屬性和表Order 對應(yīng)。核心代碼如下:package 。/** * p訂單類 /p */public class order { private long Id。 //ID序列號 private String orderId。 //訂單編號 private long UserId。 //用戶序列號 private String SubmitTime。 //提交訂單時間 private String ConsignmentTime。 //交貨時間 private float TotalPrice。 //總金額 private String content。 //用戶備注 private String IPAddress。 //下單時IP private boolean IsPayoff。 //用戶是否已付款 private boolean IsSales。 //是否已發(fā)貨 public order() { //在構(gòu)造方法里初始化變量 Id = 0。 orderId = 。 UserId = 0。 SubmitTime = 。 ConsignmentTime = 。 TotalPrice = 0。 content = 。 IPAddress = 。 信息工程系 計網(wǎng)班第 22 頁 共 50 頁 IsPayoff = false。 IsSales = false。 } public long getId() { return Id。 } ……其中的 seter 和 geter 方法用來設(shè)置和獲取以上各屬性的值。在 jsp 頁面中通過 jsp:useBean引入。(5)實現(xiàn)訂單列表的 Bean 這個類是對訂單列表實體的抽象,它包含了 訂單實 體的所有屬性及訂單列表對象的初始化構(gòu)造方法,它的屬性和表 Allorders 對應(yīng),部分代碼如下:package 。/** * pTitle: /p */public class allorder { private long Id。 //ID序列號 private long orderId。 //訂單號表序列號 private long BookNo。 //圖書表序列號 private int Amount。 //訂貨數(shù)量 public allorder() { Id = 0。 orderId = 0。 BookNo = 0。 Amount = 0。 } public long getId() { return Id。 } 信息工程系 計網(wǎng)班第 23 頁 共 50 頁 ………其中的 seter 和 geter 方法用來設(shè)置和獲取以上各屬性的值。在 jsp 頁面中通過 jsp:useBean引入。(6)實現(xiàn)購物車實體的 Bean在現(xiàn)實生活中,人們?nèi)コ匈I東 西,都是把商品放在一個 購 物籃里,等到把所有要買的東西選購?fù)戤吅?,一起拿到收銀臺前付 錢。我在程序里定 義的購物 ,購物時間,所購書的總價格都是必不可少的,這個類是對購 物車實體的抽象,它包含了購物車的所有屬性及購物車對象的初始化構(gòu)造方法。部分代碼如下:package 。/** * pTitle: /p */public class shopcar { private long bookId。 //圖書ID編號 private int quanlity。 //選購數(shù)量 public shopcar(){ bookId = 0。 quanlity = 0。 } public long getBookId() { return bookId。 }(7)管理用戶登錄 Bean 的編寫這是一個以客戶為中心的交易平臺,只有成 為了系統(tǒng)的合法用 戶才有使用本系統(tǒng)的權(quán)利,因此需要檢測每個用戶的合法性,管理用 戶登錄這個 Bean: 就是要完成這一功能。圖 為Login 類 的類圖其中只是關(guān)鍵 的
點(diǎn)擊復(fù)制文檔內(nèi)容
法律信息相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1