概述:
本实训项目是本科教学中,Android课程实训的项目,旨在训练Android App訪问server,获取server数据,解析,并呈现的流程。主要包括的功能有:
1、用户注冊
2、登录
3、查看文档
4、下载电子书
5、阅读电子书
6、用户管理
设计说明:
该实训项目须要开发Androidclient和server端应用。
server端採用Struts2,直接使用JDBC訪问MySQL数据库。
client使用xutils框架,訪问action,获取JSON字符串。
开发环境:
server端採用MyEclipse,版本号能够採用9、10等等,数据库使用MySQL
Android端採用adt-bundle Eclipse 4.2
数据库设计:
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `tb_accountinfo`
-- ----------------------------
DROP TABLE IF EXISTS `tb_accountinfo`;
CREATE TABLE `tb_accountinfo` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`loginName` varchar(20) NOT NULL,
`loginPwd` varchar(100) NOT NULL,
`level` int(11) NOT NULL,
`lastLoginDate` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`lastLoginIP` varchar(20) DEFAULT NULL,
`score` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; -- ----------------------------
-- Records of tb_accountinfo
-- ----------------------------
INSERT INTO `tb_accountinfo` VALUES ('1', 'admin', 'admin', '1', '2015-06-25 10:13:18', '127.0.0.1', '100');
INSERT INTO `tb_accountinfo` VALUES ('2', 'aaa', '123', '0', '2015-07-06 15:39:03', '10.2.212.18', '0');
INSERT INTO `tb_accountinfo` VALUES ('3', 'abc', '111', '0', '2015-07-06 15:39:39', '10.2.212.18', '0');
INSERT INTO `tb_accountinfo` VALUES ('4', '', '', '0', '2015-07-06 15:42:38', '10.2.212.18', '0');
INSERT INTO `tb_accountinfo` VALUES ('5', 'bbb', '123', '0', '2015-07-06 15:49:52', '10.2.212.18', '0'); -- ----------------------------
-- Table structure for `tb_ebookcomment`
-- ----------------------------
DROP TABLE IF EXISTS `tb_ebookcomment`;
CREATE TABLE `tb_ebookcomment` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`comment` varchar(200) NOT NULL,
`ebookId` int(11) NOT NULL,
`accountId` int(11) NOT NULL,
`createDate` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `accountId` (`accountId`),
KEY `tb_ebookcomment_ibfk_1` (`ebookId`),
CONSTRAINT `tb_ebookcomment_ibfk_1` FOREIGN KEY (`ebookId`) REFERENCES `tb_ebookinfo` (`id`) ON DELETE NO ACTION,
CONSTRAINT `tb_ebookcomment_ibfk_2` FOREIGN KEY (`accountId`) REFERENCES `tb_accountinfo` (`id`) ON DELETE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8; -- ----------------------------
-- Records of tb_ebookcomment
-- ----------------------------
INSERT INTO `tb_ebookcomment` VALUES ('1', 'verygood', '1', '1', '2015-07-01 16:41:14');
INSERT INTO `tb_ebookcomment` VALUES ('2', 'dfdjsfsdlfjslfsd', '1', '1', '2015-07-01 16:41:43');
INSERT INTO `tb_ebookcomment` VALUES ('5', 'test', '3', '1', '2015-07-01 16:42:05');
INSERT INTO `tb_ebookcomment` VALUES ('13', 'test', '4', '1', '2015-07-01 16:46:26');
INSERT INTO `tb_ebookcomment` VALUES ('14', 'test', '4', '1', '2015-07-01 16:46:46');
INSERT INTO `tb_ebookcomment` VALUES ('15', 'test', '5', '1', '2015-07-09 10:20:37');
INSERT INTO `tb_ebookcomment` VALUES ('16', 'test', '4', '1', '2015-07-01 16:46:46');
INSERT INTO `tb_ebookcomment` VALUES ('17', 'test', '4', '1', '2015-07-01 16:46:46');
INSERT INTO `tb_ebookcomment` VALUES ('18', 'test', '7', '1', '2015-07-09 10:20:44');
INSERT INTO `tb_ebookcomment` VALUES ('19', 'test', '4', '1', '2015-07-01 16:46:47');
INSERT INTO `tb_ebookcomment` VALUES ('20', 'test', '4', '1', '2015-07-01 16:46:47');
INSERT INTO `tb_ebookcomment` VALUES ('21', 'googodoodogogoododgodo', '1', '1', '2015-07-10 15:46:50');
INSERT INTO `tb_ebookcomment` VALUES ('22', 'okkkk', '1', '1', '2015-07-10 15:47:19');
INSERT INTO `tb_ebookcomment` VALUES ('23', 'new log', '2', '1', '2015-07-10 15:48:23');
INSERT INTO `tb_ebookcomment` VALUES ('24', 'viery goood hehe', '2', '1', '2015-07-10 15:48:45');
INSERT INTO `tb_ebookcomment` VALUES ('25', 'oooppp', '1', '1', '2015-07-10 16:09:27');
INSERT INTO `tb_ebookcomment` VALUES ('26', 'teswts log', '3', '1', '2015-07-10 16:10:12'); -- ----------------------------
-- Table structure for `tb_ebookinfo`
-- ----------------------------
DROP TABLE IF EXISTS `tb_ebookinfo`;
CREATE TABLE `tb_ebookinfo` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`bookName` varchar(50) NOT NULL,
`bookType` int(11) NOT NULL,
`bookScore` int(11) NOT NULL,
`author` varchar(20) DEFAULT NULL,
`bookDes` varchar(200) DEFAULT NULL,
`bookPath` varchar(200) NOT NULL,
`bookFacePath` varchar(200) DEFAULT NULL,
`uploadDate` date DEFAULT NULL,
`isTop` tinyint(4) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `bookType` (`bookType`),
CONSTRAINT `tb_ebookinfo_ibfk_1` FOREIGN KEY (`bookType`) REFERENCES `tb_ebooktype` (`id`) ON DELETE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; -- ----------------------------
-- Records of tb_ebookinfo
-- ----------------------------
INSERT INTO `tb_ebookinfo` VALUES ('1', '巴顿将军', '7', '5', '佚名', '巴顿将军戎马一生。二战中最为强悍的指挥官……', '/books/01.txt', '/faces/01.jpg', '2015-06-25', '1');
INSERT INTO `tb_ebookinfo` VALUES ('2', '三国演义', '2', '4', '罗贯中', '混乱的三国……', '/books/01.txt', '/faces/02.jpg', '2015-06-25', '1');
INSERT INTO `tb_ebookinfo` VALUES ('3', '那时汉朝', '2', '0', '佚名', '穿越汉朝的简明史……', '/books/02.txt', '/faces/02.jpg', '2015-06-25', '1');
INSERT INTO `tb_ebookinfo` VALUES ('4', '逃离地球', '3', '0', '佚名', '第三次世界大战后,地球核污染严重……', '/books/01.txt', '/faces/02.jpg', '2015-06-25', '1');
INSERT INTO `tb_ebookinfo` VALUES ('5', '狮子王记', '4', '0', '小马哥', '狮子王登记日,时逢魔王转生……', '/books/01.txt', '/faces/02.jpg', '2015-06-25', '1');
INSERT INTO `tb_ebookinfo` VALUES ('6', '家', '5', '0', '巴金', '巴金最具代表性著作之中的一个……', '/books/01.txt', '/faces/02.jpg', '2015-06-25', '1');
INSERT INTO `tb_ebookinfo` VALUES ('7', '泰戈尔诗集', '6', '0', '佚名', '世界诗歌中的一颗明珠……', '/books/01.txt', '/faces/02.jpg', '2015-06-25', '1');
INSERT INTO `tb_ebookinfo` VALUES ('8', '冷兵器时代', '1', '0', '佚名', '在长达2000年的冷兵器战争史中……', '/books/01.txt', '/faces/03.jpg', '2015-06-25', '1');
INSERT INTO `tb_ebookinfo` VALUES ('9', '乔布斯传记', '7', '0', '佚名', '缔造苹果伟业,不世出之奇人……', '/books/01.txt', '/faces/04.jpg', '2015-06-25', '1'); -- ----------------------------
-- Table structure for `tb_ebooktype`
-- ----------------------------
DROP TABLE IF EXISTS `tb_ebooktype`;
CREATE TABLE `tb_ebooktype` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`typeName` varchar(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; -- ----------------------------
-- Records of tb_ebooktype
-- ----------------------------
INSERT INTO `tb_ebooktype` VALUES ('1', '军事');
INSERT INTO `tb_ebooktype` VALUES ('2', '历史');
INSERT INTO `tb_ebooktype` VALUES ('3', '科幻');
INSERT INTO `tb_ebooktype` VALUES ('4', '魔幻');
INSERT INTO `tb_ebooktype` VALUES ('5', '文学');
INSERT INTO `tb_ebooktype` VALUES ('6', '诗歌');
INSERT INTO `tb_ebooktype` VALUES ('7', '人物传记'); -- ----------------------------
-- Table structure for `tb_userinfo`
-- ----------------------------
DROP TABLE IF EXISTS `tb_userinfo`;
CREATE TABLE `tb_userinfo` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userName` varchar(20) NOT NULL,
`userPhone` varchar(11) NOT NULL,
`userMail` varchar(30) DEFAULT NULL,
`userSex` char(2) DEFAULT NULL,
`userAddress` varchar(200) DEFAULT NULL,
`userMajor` varchar(20) DEFAULT NULL,
`accountId` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `accountId` (`accountId`),
CONSTRAINT `tb_userinfo_ibfk_1` FOREIGN KEY (`accountId`) REFERENCES `tb_accountinfo` (`id`) ON DELETE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; -- ----------------------------
-- Records of tb_userinfo
-- ----------------------------
INSERT INTO `tb_userinfo` VALUES ('1', '曹操', '13900001234', 'cc@mail.com', '男', '天津市西青区大学城', '学生', '1');
INSERT INTO `tb_userinfo` VALUES ('3', '刘备', '13800001234', null, '男', '北京', null, '1');
终于效果:
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">