【正文】
JSP的技術(shù)發(fā)展歷史作者: Kathy Sierra and Bert Bates來源: Servletamp。我想到過很多方案,比如把題目和標準答案放到一個個文件中,但這樣就需要設(shè)計文件讀取的接口,很麻煩,還想到過把整張試卷放到文件中,那也很麻煩,最終確定用8張表(選擇題題庫表,填空題題庫表,試卷表,試卷—題庫表,試卷—填空題標,考試表,考試填空題表,考試選擇題表)來確定關(guān)系。軟件開發(fā)過程中不可避免的會犯一些錯誤,軟件測試雖然不能杜絕系統(tǒng)錯誤的產(chǎn)生,但可以大大地增加軟件的可靠性。尤其是在題庫的設(shè)計,沒有設(shè)置試題的難易程度,學(xué)生考試就不能有層次性的進行測試了。綜上所述,本系統(tǒng)已經(jīng)完成了任務(wù)書的全部功能。之后成功的添加、修改了選擇題、填空題、試卷、學(xué)生信息,之后安全退出。黑盒測試法[18](又稱功能測試法)是把程序看成一個黑盒子,完全不考慮程序的內(nèi)部結(jié)構(gòu)和處理過程,是在程序接口進行的測試,它只檢查程序功能是否按照規(guī)格說明書的規(guī)定正常使用。確切的說,軟件測試就是為了發(fā)現(xiàn)錯誤而執(zhí)行的過程。 (url, url)。 url = ().getInitParameter(basepath) + TestPaperList。 (url, url)。 (new SimpleDateFormat(yyyyMMdd HH:mm:ss) .parse(enddate))。 (url, url)。 (new SimpleDateFormat(yyyyMMdd HH:mm:ss) .parse(startdate))。 (teo)。 DAO dao = new DaoTestpaper()。 String enddate = (enddate)。 String course = (course)。實現(xiàn)在線制作試卷代碼如下: (utf8)。即使再添加同名同賬號的學(xué)生也不能恢復(fù)。還可以向時間中增加、刪除、排序題目,以及修改各個題目的分值。課程管理:添加和刪除課程,刪除課程將刪除該課程的所有試題,試卷,已經(jīng)所有學(xué)生的該課程的考試記錄和成績。 } } (message, message)。 (test)。 //存儲學(xué)生考試填空題信息(my)。 (myanswer)。 (answer)。//獲取填空題 for (Model model : list2) { dao = new DaoMytestCom()。//存儲學(xué)生考試選擇題信息 (mychoice)。 (id)。 (answer)。 for (Model model : list1) { dao = new DaoMytestChoice()。 MytestCom my = new MytestCom()。 String myanswer = 。 (testno)。 Mytest test = new Mytest()。 int testno = 0。//存儲試卷信息 (student/).forward(request, response)。 testpaper = (Testpaper) new DaoTestpaper().getModelByPK(testpaper)。 for (Model model : list2) { if (null != model) { ((PaperCom) model)。 (((PaperChoice) model).getAdddate() .toString())。 DAO dao = new DaoPaperChoice()。代碼如下:protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Autogenerated method stub (utf8)??忌梢酝ㄟ^首頁登錄進入進入學(xué)生主頁,在主頁上有三個鏈接,分別是在線考試,參加過的考試,個人信息修改。JSP+JavaBean+servlet模式的運用實現(xiàn)了代碼的重復(fù)利用;是系統(tǒng)程序易編寫、易維護、易使用;并且可以在任何安裝了Java運行環(huán)境的平臺上使用而不需要重新編譯。//重定向到學(xué)生主頁 else (teacher/).forward( request, response)。程序代碼片段如下:protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = ()。 (role, role)。//判斷密碼是否正確 if (null != teacher amp。 } } if (teacher.equals(role)) {///判斷是否用teacher身份登錄 Teacher teacher = new Teacher()。 (().trim())) { //如果用戶輸入的密碼和數(shù)據(jù)庫中存儲的相等,登錄成功,//并存儲用戶的登錄信息 User user = new User(username, password, role)。 DAO dao = new DaoStudent()。 ( + username + password + role)。(role, role)。 }用戶登錄頁面比較簡單,為防止用戶登錄的操作錯誤,應(yīng)設(shè)置錯誤處理頁面,在登錄操作過程中,一般發(fā)生的錯誤有:用戶輸入了錯誤的用戶名或密碼、用戶直接單擊了登錄按鈕,對上述情況的判斷就要通過Servlet文件來實現(xiàn)。 }打開控制面板/管理工具/odbc數(shù)據(jù)源。再介紹系統(tǒng)主要部分的實現(xiàn)方法。還確定了采用jsp+servlet+bean的MVC設(shè)計模式,規(guī)劃了系統(tǒng)的功能模塊。Servlet用來處理請求的事務(wù),充當控制器(Controller即C)的角色,Servlet負責響應(yīng)用戶對業(yè)務(wù)邏輯的請求并根據(jù)用戶的請求行為,決定將哪個JSP頁面發(fā)送給客戶。JavaBean則負責數(shù)據(jù)的處理,也就是模型(Model即M)的角色。JSP頁面處于表現(xiàn)層,也就是視力(View即V)的角色。它們各自處理自己的任務(wù)。試卷信息管理模塊功能:教師對試卷的基本信息的維護,實現(xiàn)對試卷及其信息(如分數(shù))的增,刪,改,考試時間的設(shè)定。最初設(shè)計方案時,就要規(guī)劃好哪些模塊是可以提出來多次使用,哪些模塊雖只使用一次,但提出來之后能使代碼更清晰等。如用戶信息表中的用戶名設(shè)置為主鍵,并且要求唯一且不能為空,并且為了保證刪除數(shù)據(jù)時的完整性,還是用了instead of類型的觸發(fā)器[12],觸發(fā)器如下:/****** 對象: 觸發(fā)器 ******/CREATE TRIGGER deletetbchoice ON [dbo].[tbchoice] instead of DELETE ASbegindelete from tbpaperchoice where titleno in(select titleno from deleted)delete from tbmytestchoice where titleno in(select titleno from deleted)delete from tbchoice where titleno in(select titleno from deleted)end/****** 對象: 觸發(fā)器 ******/CREATE TRIGGER [deletetbpletion] ON [dbo].[tbpletion] instead of DELETE ASbegindelete from tbpaper where titleno in(select titleno from deleted)delete from tbmytest where titleno in(select titleno from deleted)delete from tbpletion where titleno in(select titleno from deleted)end/****** 對象: 觸發(fā)器 ******/CREATE TRIGGER deletetbcourse ON [dbo].[tbcourse] instead of DELETE ASbegindelete from tbchoice where course in(select course from deleted)delete from tbpletion where course in(select course from deleted)delete from tbtestpaper where course in(select course from deleted)delete from tbcourse where course in(select course from deleted)end/****** 對象: 觸發(fā)器 ******/CREATE TRIGGER deletetbmytest ON [dbo].[tbmytest] instead of DELETE ASbegindelete from tbmytestchoice where [id] in (select [id] from DELETED)delete from tbmytest where [id] in (select [id] from DELETED)delete from tbmytest where [id] in(select [id] from deleted)end/****** 對象: 觸發(fā)器 ******/CREATE TRIGGER deletetbstudent ON [dbo].[tbstudent] instead of DELETE ASbegindelete from tbmytest where stuno in(select stuno from deleted)delete from tbstudent where stuno in(select stuno from deleted)end/****** 對象: 觸發(fā)器 ******/CREATE TRIGGER deletetteacher ON [dbo].[tbteacher] instead of DELETE ASbegindelete from tbtestpaper where teo in(select teo from deleted)delete from tbpaperchoice where teo in(select teo from deleted)delete from tbpaper where teo in(select teo from deleted)delete from tbchoice where teo in(select teo from deleted)delete from tbpletion where teo in(select teo from deleted)delete from tbteacher where teo in(select teo from deleted)end/****** 對象: 觸發(fā)器 ******/CREATE TRIGGER deletetestpaper ON [dbo].[tbtestpaper] instead of DELETE ASbegindelete from tbpaperchoice where testno in(select testno from deleted)delete from tbpaper where testno in(select testno from deleted)delete from tbmytest where testno in(select testno from deleted)delete from tbtestpaper where testno in (select testno from deleted)end本次采用3NF為規(guī)范準則來分解關(guān)系。: 概念關(guān)系模型圖完整性要求用于描述各種信息之間的制約關(guān)系,以及關(guān)聯(lián)關(guān)系,各個數(shù)據(jù)項的取值范圍以及各個數(shù)據(jù)項是否可以取值。綜合以上分析,要實現(xiàn)上面的所有功能模塊,數(shù)據(jù)庫共要設(shè)計十一張表,它們分別是:科目表(tbcourse)、教師信息表(tbteacher)、學(xué)生信息表(tbstudent)試卷信息表(tbtestpaper)、選擇題題庫表(tbchoice)、填空題題庫表(tbpletion)、選擇題表(tbpaperchoice)、填空題表(tbpaper)、考試表(tbmytest)、考試選擇題表(tbtestchoice)、考試填空題表(tbtest)根據(jù)所要實現(xiàn)的功能和用戶權(quán)限的