Struts2-综合项目

综合项目:视频后台管理系统

开发环境:Tomcat6(服务器)+jdk6(windows操作系统)

使用技术:struts2(后台)+jsp(前台显示)+ajax(信息传递)+json(服务器响应前台,发送数据的格式)

课程方向:
create table course(
    id int primary key auto_increment,
    name varchar(30)
);
insert into course values(null,'JAVA');
insert into course values(null,'UID');

课程内容:
create table lore(
    id int primary key auto_increment,
    name varchar(30),
    course_id int
);

insert into lore values(null,'面向对象',1);
insert into lore values(null,'异步交互',1);
insert into lore values(null,'后台框架',1);
insert into lore values(null,'页面设计',2);
insert into lore values(null,'网页基础',2);

产品表:
create table product(
    id int primary key auto_increment,
    name varchar(30),
    course_id int,
    lore_id int,
    description text,
    status char(1),//0:免费,1:收费
    price double(7,2),
    image varchar(30),
    video varchar(30),
    creater varchar(30),
    createtime datetime
);

 

管理员:

create table admin(
id int primary key auto_increment,
username varchar(30),
password varchar(30),
realname varchar(30
));

insert into admin values(null,'user01','1234','用户01');
insert into admin values(null,'user02','1234','用户02');
insert into admin values(null,'user03','1234','用户03');
insert into admin values(null,'user04','1234','用户04');

定义角色表:

create table role(
id int primary key auto_increment,
name varchar(30)
);

insert into role values(null,'超级管理员');
insert into role values(null,'用户管理员');
insert into role values(null,'产品管理员');

管理员与角色的中间表(管理员与角色的对应关系)

create table admin_role(
id int primary key auto_increment,
admin_id int,
role_id int 
);

insert into admin_role values(null,1,1);
insert into admin_role values(null,2,2);
insert into admin_role values(null,3,3);

权限表:

create table privilege(
id int primary key auto_increment,
name varchar(30)
);

insert into privilege values(null,'查看管理员');
insert into privilege values(null,'查看角色');
insert into privilege values(null,'查看会员');
insert into privilege values(null,'查看产品');
insert into privilege values(null,'上传产品');

角色与权限的中间表:
create table role_privilege(
id int primary key auto_increment,
role_id int,
privilege_id int
);

insert into role_privilege values(null,1,1);
insert into role_privilege values(null,1,2);
insert into role_privilege values(null,1,3);
insert into role_privilege values(null,1,4);
insert into role_privilege values(null,1,5);

登录模块一般涉及到这5张表

 

往myeclipse里面导入javaweb项目时,有时候导入的.js文件会有一个小红叉,原因是编码的问题,右击->首选项->编码方法改成utf-8即可。

会员(mysql时间类型可以去查看下):
create database videocms default character set utf8;
create table user(
  int id primary key auto_increment,
  username varchar(30),
  email varchar(30),
  registtime datetime            
);
时间类型:datetime(周期长)  timestamp(2038年以后不能表示了  年月日时分秒)
insert into user values(null,'jack','111111@163.com',now());
insert into user values(null,'jack','111111@163.com',now());
insert into user values(null,'jack','111111@163.com',now());

  jdbc:mysql://localhost:3306/videocms?useUnicode=true&characterEncoding=utf8                          避免出现中文,乱码,存不进去,MySQL内存存数据用Unicode,

面试题:“我爱Java”,在Java内存中占几个字节?  在Java内存中用的是Unicode编码,中英文都占2个字节,所以这段话一共占16个字节

posted @ 2018-06-22 10:09  阴翳公子  阅读(172)  评论(0编辑  收藏  举报