Record learning every day, have a good mood every day. * ^ _ ^ *
When learning computer grade examination system design and implementation of the project, to facilitate future access to timely, record it in this platform in the development process of the project. In the study, when the selection of the SSM (MYECLIPSE), whether this framework is to learn or use are very convenient, simple and approachable. Is a framework for us to learn programming can focus on learning, and I designed and when implementing projects selected MYECLIPSE to build SSM (MYECLIPSE) framework in the development of computer grade examination system, the final design and implementation of project development for a background item Computer Rank Examination System .
The project has a user role, including the administrator, student, each character contains its own user name and password.
The summary results for all data systems: the administrator (admin), title (timu), students (xuesheng), exam (kaoshi)
Administrators table
Field Name | Type | property | describe the above mentioned id | INT ( 11 ) | PRIMARY KEY | administrator the above mentioned id username | VARCHAR ( 255 ) | | account password | VARCHAR ( 255 ) | | password
Table title
Field Name | Type | property | describe the above mentioned id | INT ( 11 ) | PRIMARY KEY | topics timu | VARCHAR ( 255 ) | | subject neirong | VARCHAR ( 255 ) | | Content Wenjian | VARCHAR ( 255 ) | | file
Student Table
Field Name | Type | property | describe the above mentioned id | INT ( 11 ) | PRIMARY KEY | student the above mentioned id mingzi | VARCHAR ( 255 ) | | name username | VARCHAR ( 255 ) | | account password | VARCHAR ( 255 ) | | password
Examination table
Field Name | Type | property | describe the above mentioned id | INT ( 11 ) | PRIMARY KEY | test the above mentioned id mingcheng | VARCHAR ( 255 ) | | Name Shijian | VARCHAR ( 255 ) | | Time
SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- ---------------------------- -- Table structure for ggjisuanjikaoshi -- ---------------------------- DROP TABLE IF EXISTS `t_admin`; CREATE TABLE `t_admin` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '管理员id',`username` VARCHAR(255) DEFAULT NULL COMMENT '账号', `password` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' password ' , a PRIMARY KEY (` id`) ) ENGINE = MyISAM the DEFAULT the CHARSET = UTF8 the COMMENT = ' Administrators ' ; - ----------- ----------------- the DROP TABLE the IF EXISTS `t_timu`; the CREATE TABLE ` t_timu` ( `id` the INT ( . 11 ) the NOT NULL the AUTO_INCREMENT the COMMENT ' Title ', `timu` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' subject ' ,` neirong` VARCHAR ( 5000 ) the DEFAULT NULL the COMMENT ' content ' , `wenjian` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' files ' , a PRIMARY KEY (` id`) ) ENGINE = MyISAM the DEFAULT the CHARSET = UTF8 the COMMENT = ' Title ' ; -- ---------------------------- DROP TABLE IF EXISTS `t_xuesheng`; CREATE TABLE `t_xuesheng` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '学生id',`mingzi` VARCHAR(255) DEFAULT NULL COMMENT '名字',`username` VARCHAR(255) DEFAULT NULL COMMENT '账号',`password` VARCHAR(255) DEFAULT NULL COMMENT '密码',PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='学生'; -- ---------------------------- DROP TABLE IF EXISTS `t_kaoshi`; CREATE TABLE `t_kaoshi` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '考试id',`mingcheng` VARCHAR(255 ) the DEFAULT NULL the COMMENT ' name ' , `shijian` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' time ' , a PRIMARY KEY (` id`) ) ENGINE = MyISAM the DEFAULT the CHARSET = UTF8 the COMMENT = ' test ' ;
Add topic modules:
Function exists in the system to add the title, the title may be added by clicking the jump to the functional module, the functional module, the title information corresponding to the fill. Title Title contains information, content, documents, after filling out all the information, the data submitted by the post method to tianjiatimu.action, the address server responds timuController tianjiatimuact Method in class. Response result, for all the acquired title information, a package timu class, using the insert method timudao timuController defined in the class, the subject is inserted into timu data table in the database. And gives the user prompts, add title success, save the information to the message request, this information will be shown on the page. The part of the core code is as follows:
The title page transmitted by the insert method timudao added to the database timudao.insert (timu);
Add the successful title information is saved to the message request, the user is given prompt request.setAttribute in the page ( "message", "add the title successfully");
Return to the title management interface
return "forward:/tianjiatimu.action";
Query module topics:
In the background timuguanli method, get all the data through selectByexample method. Save it to your request by foreach method in the page
Circulated to display the table. Complete title queries. Specific code as follows:
Generating a subject-based sample, defined by the example query TimuExample example = new TimuExample ();
Title information of all inquiries List timuall = timudao.selectByExample (example) by the method timudao of selectByExample;
The title information is saved to the request, on display request.setAttribute ( "timuall", timuall) page by foreach method;
Return to the title management interface
return "forward:/timuguanli.action";
Modify subject modules:
Click the Edit button, you can jump to change the title page. Modification in the title page, initialize all the information and the subject information correspond to the corresponding edit field is filled. After editing title information, page by encapsulating the data post method is a topic entity, passed into the timuController. In xiugaitimu the reception, after reception is completed, the call updateByPrimaryKeySelective method timuMapper modified. The part of the code as follows:
Modifying the corresponding title timudao.updateByPrimaryKeySelective (timu) by modifying the method according to the id of timudao;
The title successfully modify information stored in the message request, give the user prompt request.setAttribute in the page ( "message", "modify title information successfully");
Return to the title management interface
return "forward:/timuguanli.action";
Delete Topic module:
Delete topics functions implemented in timuController, the implementation is shanchutimu. Shanchutimu.action the page by the get method? Id form the subject will need to remove id uploaded to the server in response to a corresponding method, the call deleteByPrimaryKey timudao method, complete the deletion. Will delete successful message is returned to the page, complete the operation to delete data. The part of the core code:
Deletes the corresponding title timudao.deleteByPrimaryKey (id) id by removing method according to the timudao;
The topic will be deleted success information, save it to request the message, the user is given prompt request.setAttribute in the page ( "message", "Delete title success");
Return to the title management interface
return "forward:/timuguanli.action";