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

正文內(nèi)容

畢業(yè)論文設(shè)計(jì)-信息公示板類(lèi)網(wǎng)站的設(shè)計(jì)與實(shí)現(xiàn)-閱讀頁(yè)

2025-01-27 20:13本頁(yè)面
  

【正文】 中提倡使用 Struts HTML 標(biāo)簽庫(kù),因?yàn)檫@些標(biāo)簽可以和 Struts 框架的其他組件緊密地聯(lián)系在一起。在系統(tǒng)首頁(yè),使用“ %include file=”” %語(yǔ)句將 3個(gè)公有文件 、 及 包含進(jìn)來(lái)。 文件描述網(wǎng)站的尾部,網(wǎng)站的尾部多用于說(shuō)明網(wǎng)站的版權(quán)信息 。由于以 ” .do” 為后綴的 Action 請(qǐng)求不屬于Web 服 務(wù) 器 規(guī) 定 的 首 頁(yè) , 所 以 需 要 在 文 件 中 使用 ” jsp:forward page=” ” /” 標(biāo)簽轉(zhuǎn)發(fā)到首頁(yè)的 Actio控制器,然后再由控制器轉(zhuǎn)入 歡迎首頁(yè)。 關(guān)鍵代碼如下所示: html:html body bgcolor=FFFFFF leftmargin=0 topmargin=0 marginwidth=0marginheight=0 load=clockon(bgclock) ! 注冊(cè)成功彈出對(duì)話框 信息公示板類(lèi)網(wǎng)站的設(shè)計(jì)與實(shí)現(xiàn) 23 % if((name)==null){//判斷是否登錄 % %include file= % %}else {% %include file= % %} % %include file= % /body /html:html ( 3) 創(chuàng)建 :在 文件中,需要設(shè)計(jì)登錄驗(yàn)證并提交登錄頁(yè)面的表單數(shù) 據(jù), Struts 框架使用 html:form標(biāo)簽提交表單,如html:form action=” ” ,同時(shí)需要在表單上創(chuàng)建 HTML文本框字段,如 html:text property=” name” / 、 html:password property=” password” /。 String ztcount=(String)(ztcount)。 String todaycount=(String)(todaycount)。使用 文件可以使得開(kāi)發(fā)人員靈活組裝和配置各個(gè)組件,提高了軟件的可擴(kuò)展性和靈活性。 在設(shè)計(jì)本系統(tǒng)首頁(yè) 時(shí),發(fā)送了,這個(gè)請(qǐng)求會(huì)在 Struts 配置文件中進(jìn)行配置。 圖 論壇首頁(yè)的邏輯關(guān)系圖 信息公示板類(lèi)網(wǎng)站的設(shè)計(jì)與實(shí)現(xiàn) 25 創(chuàng)建首頁(yè) 控制器 在 Struts 框架中控制器組件包括 ActionServlet 類(lèi)和 Action 類(lèi)。Struts 框架提供可擴(kuò)展的 Action 類(lèi),用于處理特定的 HTTP 請(qǐng)求。 關(guān)鍵代碼如下所示: public class IndexAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response) { ActionMessages message=new ActionMessages()。//取 struts配置的數(shù)據(jù)源 HttpSession session=()。 List list=(datasource)。 //取出論壇全部信息內(nèi)容 int ztcount=(datasource)。 //取總共帖子數(shù) int todaycount=(datasource)。 (ztcount, ztcount+)。 (todaycount, todaycount+)。 //論壇個(gè)數(shù) return ()。 關(guān)鍵代碼如下: ID 查詢 該論壇的詳細(xì)信息。 // String name=null。 DB d = new DB(datasource)。 try { String sql = select * from tb_forum where id=39。 rs = (sql)。 while (()) { ForumBean f = new ForumBean()。 ((forumname))。 ((createtime))。 // ((datasource))。 } rs = null。 } ()。 } 。 // String name=null。 DB d = new DB(datasource)。 try { String sql = select count(*) from tb_topic where forumid=39。 rs = (sql)。 } } catch (Exception e) { ()。 return i。 public static int getResponseCount(DataSource datasource) { ResultSet rs = null。 // String password=null。 信息公示板類(lèi)網(wǎng)站的設(shè)計(jì)與實(shí)現(xiàn) 28 int i = 0。 rs = (sql)。 } } catch (Exception e) { ()。 return i。 } 題的總數(shù)。 // String name=null。 DB d = new DB(datasource)。 try { String sql = select count(*) from tb_topic where (TO_DAYS(submittime)TO_DAYS(now())=0)。 while (()) { i = (1)。 } ()。 } 公共模塊設(shè)計(jì) 數(shù)據(jù)庫(kù)連接 1. 配置數(shù)據(jù)源 在 Struts 框 架 中 , 使 用 文 件 中 的datasources元素來(lái)配置數(shù)據(jù)源,數(shù)據(jù)源負(fù)責(zé)建立和特定數(shù)據(jù)庫(kù)的連接。 在 , datasources元素用于指定使用某種數(shù)據(jù)源,其中包括多個(gè) ,setproperty元素,用于指定數(shù)據(jù)源的各種屬性,例如連接何種數(shù)據(jù)庫(kù),連接數(shù)據(jù)庫(kù)用戶名、密碼等。 配置數(shù)據(jù)源的關(guān)鍵代碼如下: datasources datasource type= key=dataSources setproperty property=driverClassName value= / setproperty property=url value=jdbc: / 信息公示板類(lèi)網(wǎng)站的設(shè)計(jì)與實(shí)現(xiàn) 30 setproperty value=20 property=maxCount / setproperty value=1 property=minCount / setproperty property=username value=root / setproperty property=password value=root / /datasource /datasources 配置數(shù)據(jù)源完成后,可以在 Action 類(lèi)中訪問(wèn)數(shù)據(jù)源。 關(guān)鍵代碼如下: //取 struts 配置的數(shù)據(jù)源 DataSource datasource = getDataSource(request,dataSources)。創(chuàng)建數(shù)據(jù)庫(kù)輔助類(lèi)得步驟如下: ( 1) 在一般情況下,會(huì)將數(shù)據(jù)庫(kù)連接代碼放入構(gòu)造函數(shù)中。 try { connect = ()。 } } ( 2) 創(chuàng)建查詢數(shù)據(jù)庫(kù)表的方法。 rs=(sql)。 try{ if(stmt!=null) ()。 } } return rs。 關(guān)鍵代碼如下: public int ExecSql(String sql){ int result=0。 result=(sql)。 ()。 try{ if(stmt!=null) ()。 } } return result。 數(shù)據(jù)庫(kù)關(guān)閉方法關(guān)鍵代碼如下: public void close() { try { if (stmt != null) { ()。 } if (connect != null) { ()。 //(***************** a connection is closed)。 }finally{ connect=null。 } } 信息公示板類(lèi)網(wǎng)站的設(shè)計(jì)與實(shí)現(xiàn) 33 配置消息資源文件 1. 在 置消息資源文件 在 文件中, messageresources元素用來(lái)配置本地化文本消息,使用 parameter 參數(shù)指定消息資源文件名。 ( 1) 。 ( 3) 。 最后返 回 ActionForward 對(duì)象, Struts 框架 會(huì)根據(jù)ActionForward 對(duì)象包含的轉(zhuǎn)發(fā)信息轉(zhuǎn)發(fā)到相應(yīng)的視圖組件,同時(shí)在視圖組件中調(diào)用 html:error/標(biāo)簽,即可將 ActionMessage對(duì)象中的錯(cuò)誤信息顯示出來(lái)。 saveErrors(request,error)。 在本系統(tǒng)中, ISO88591編碼轉(zhuǎn)換為 UTF8的方法。 byte temp[]。 result=new String(temp,UTF8)。 } return result。在登錄窗口中輸入用戶名、密碼后,點(diǎn)擊“提交”按鈕,待身份驗(yàn)證成功后,即可進(jìn)入 BBS 論壇系統(tǒng)。 圖 用戶登錄頁(yè)面 1. 用戶登錄邏輯描述 在 Struts 框架中,使用 MVC 模式開(kāi)發(fā) M 為模型,由 JavaBean 來(lái)實(shí)現(xiàn); V為視圖,由 JSP文件構(gòu)成; C為控制器,由 Action 來(lái)實(shí)現(xiàn)。 首先需要設(shè)計(jì)一個(gè)登錄視圖。當(dāng)用戶提交表單后,系統(tǒng) 會(huì)自動(dòng)根據(jù) 配置文件中的配置信息將表單數(shù)據(jù)提交到相應(yīng)的 Action控制器,在 Action 控制器中進(jìn)行表單驗(yàn)證操作,然后根據(jù)驗(yàn)證結(jié)果轉(zhuǎn)入不同頁(yè)面。 關(guān)鍵代碼如下所示: action attribute=loginForm input=/ name=loginForm path=/login scope=request type= forward name=error path=/ / forward name=success path=/ / forward name=adminsuccess path=/ / /action ( 2) 創(chuàng)建視圖組件 在 ,配置完成系統(tǒng)登錄功能。 此模塊視圖組件中包含一個(gè)登錄表單, 表單中包括用戶名文本框和密碼文本框 ,這兩個(gè)文本框的名稱(chēng)要和模型組件中的屬性名稱(chēng)相同,即LoginForm 類(lèi)中
點(diǎn)擊復(fù)制文檔內(nèi)容
范文總結(jié)相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1