JAVA-based cartoon display system in the framework of SSM

Record learning every day, have a good mood every day. * ^ _ ^ *

Today, a friend and together to complete a comic display system project, we use in the development of the framework is SSM (MYECLIPSE) framework. Limited knowledge of my friend, only this framework, ha ha, is designed to facilitate him. As usual selection of simple and convenient MYECLIPSE as a development tool, which is a background program. Introduction of this system is this: In this paper, the existing forums and QQ group share exchange reading comics limitations, design a set of Java Web-based comic exchange and sharing platform software engineering thinking, the use of UML tools show platform analysis. ., the entire process of designing the platform B / S architecture, the use SpringMVC framework for the development, to achieve a reading comics, mutual exchange and sharing comics, users can read the comics, comic reviews, upload comics; background administrator can category comics, comic content, user reviews and user information management. the development of this system is to solve the drawbacks of traditional comic platform can only exchange not to share., a comic display system should include user roles administrator user. In order to allow the user a smooth landing system to complete the related operations, landing roles you need to set up an account and password for each field.

The summary results of all system data: administrator (admin), comics (manhua), user (yonghu)

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

 

Cartoon table

Field Name | Type | property | describe 
the above mentioned id |  INT ( 11 ) |  PRIMARY  KEY  | comics the above mentioned id 
mingcheng |  VARCHAR ( 255 ) |  | name 
Wenjian |  VARCHAR ( 255 ) |  | file 
Jieshao |  VARCHAR ( 255 ) |  | Introduction

 

user table

Field Name | Type | property | describe 
the above mentioned id |  INT ( 11 ) |  PRIMARY  KEY  | user the above mentioned id 
nicheng |  VARCHAR ( 255 ) |  | nickname 
username |  VARCHAR ( 255 ) |  | account 
password |  VARCHAR ( 255 ) |  | password

 

 

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------

-- ----------------------------

-- Table structure for gggongyipinzhanshi

-- ----------------------------

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) DEFAULT NULL COMMENT '密码',PRIMARY KEY (`id`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='管理员';

-- ----------------------------

DROP TABLE IF EXISTS `t_manhua`;

CREATE TABLE `t_manhua` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '漫画id' , `Mingcheng` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' name ' ,` wenjian` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' file ' , `jieshao` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' introduction ' , a PRIMARY  KEY (` id` ) 

) ENGINE = MyISAM the DEFAULT the CHARSET = UTF8 the COMMENT = ' manga ';

-- ----------------------------

DROP TABLE IF EXISTS `t_yonghu`;

CREATE TABLE `t_yonghu` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '用户id',`nicheng` VARCHAR(255) DEFAULT NULL COMMENT '昵称',`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 = ' user ' ;

 

 

Add comic module:

By adding module cartoons, comic add operation can be completed. Jump on the page to add the comics page, enter the comic all the information, click Add to operate, can be submitted to the comic data to post in manhuaController. Information contained in the comics field including name, file description. In manhuaController accept all the comics by defining the parameters manhua. Using the insert method manhuadao manhua entities into the database. The process of adding data corresponding to the matching manhuaxml complete the insertion operation is performed in the sql statement in manhuaMapper. The part of the core code is as follows:

The page transmitted by the insert method manhuadao comic added to the database manhuadao.insert (manhua);

Add the comic success message, save it to a message request, the user is given the page prompt request.setAttribute ( "message", "add comic success");

Return to comics Management Interface

return "forward:/tianjiamanhua.action";

Comic query module:

When the inquiry into the comics page in the browser, then the browser address bar is manhuaguanli.action, the address will respond manhuaController class manhuaguanli, in the process, get all the information selectByexample comic method, and the information save the request, make cycle through the pages. The part of the core code is as follows:

Generating class comic sample, defined by the example query ManhuaExample example = new ManhuaExample ();

Check out all the comics Information List manhuaall = manhuadao.selectByExample (example) by selectByExample method of manhuadao;

The comic information stored in the request, on display request.setAttribute ( "manhuaall", manhuaall) page by foreach method;

Return to comics Management Interface

return "forward:/manhuaguanli.action";

Modify comic module:

Click the Edit button, you can jump to the comics page modify. Modify the page in the comic, the comic initialize all the information, and the information is filled with correspondence to the corresponding edit field. After editing comic information page by encapsulating the data post method is a cartoon entity, passed into the manhuaController. In xiugaimanhua the reception, after reception is completed, the call updateByPrimaryKeySelective method manhuaMapper modified. The part of the code as follows:

The corresponding comic manhuadao.updateByPrimaryKeySelective modified by modifying the method manhuadao id's (manhua);

The successful comic modify information stored in the message request, give the user prompt request.setAttribute in the page ( "message", "modify comics success information");

Return to comics Management Interface

return "forward:/manhuaguanli.action";

Delete comic module:

Delete function implementations for the comic, comics by clicking the Delete button, to get the server to initiate the request. Id information request includes comics, a method using int deleteByPrimaryKey receiving the incoming manhuadao id, and the id in the manhuaController. Acting in accordance with the method deletes the corresponding id comics. Finally, the success of the comic delete information back page, the part of the core code is as follows:

Delete by deleting the corresponding method according manhuadao id comic manhuadao.deleteByPrimaryKey (id);

The successful comic delete information stored in the message request, give the user prompt request.setAttribute in the page ( "message", "Delete comic success");

Return to comics Management Interface

return "forward:/manhuaguanli.action";

Guess you like

Origin www.cnblogs.com/mlxbc/p/11580922.html