SSH1环境搭建

以上视频供参考,本人操作如下:

Structs + Spring + Hibernate

( MyEclipse + MySql + Tomcat + ConnectionPool 

 

项目主要功能:

前台:

1、用户登录、注册、修改个人信息

2、查询个人提过的问题

3、检索问题

后台:

1、管理栏目:一级栏目,二级栏目

2、管理用户

3、维护管理员信息

4、用户等级维护

5、问题维护

 

一、创建数据库

net start mysql;

 

配置环境变量path:D:\Program Files\MySQL\MySQL Server 5.5\bin

mysql -uroot -p******;

create database mldn;

commit;

 

use mldn

/*==============================================================*/
/* DBMS name:      MySQL 5.0                                    */
/* Created on:     2013-3-30 16:29:22                           */
/*==============================================================*/


drop table if exists admin;

drop table if exists answer;

drop table if exists item;

drop table if exists question;

drop table if exists subitem;

drop table if exists user;

/*==============================================================*/
/* Table: admin                                                 */
/*==============================================================*/
create table admin
(
   id                   int not null,
   adminid              varchar(50),
   adminpwd             varchar(50),
   primary key (id)
);

/*==============================================================*/
/* Table: answer                                                */
/*==============================================================*/
create table answer
(
   aid                  int not null,
   quesans              longtext,
   userid               varchar(50),
   grade                varchar(50),
   anstime              datetime,
   status               int,
   qid                  int,
   primary key (aid)
);

/*==============================================================*/
/* Table: item                                                  */
/*==============================================================*/
create table item
(
   itemid               int not null,
   itemname             varchar(50),
   itemcode             int,
   primary key (itemid)
);

/*==============================================================*/
/* Table: question                                              */
/*==============================================================*/
create table question
(
   qid                  int not null,
   title                varchar(50),
   content              longtext,
   itemid               int,
   subid                int,
   userid               varchar(50),
   grade                varchar(50),
   offerscore           int,
   status               int,
   questiontime         datetime,
   clickcount           int,
   acceptlag            int,
   commenflag           int,
   primary key (qid)
);

/*==============================================================*/
/* Table: subitem                                               */
/*==============================================================*/
create table subitem
(
   subid                int not null,
   subname              varchar(50),
   itemid               int,
   subcode              int,
   primary key (subid)
);

/*==============================================================*/
/* Table: user                                                  */
/*==============================================================*/
create table user
(
   id                   int not null,
   userid               varchar(50),
   userpwd              varchar(50),
   userques             varchar(50),
   userans              varchar(50),
   usermail             varchar(50),
   integral             int,
   grade                int,
   sex                  varchar(2),
   realname             varchar(50),
   primary key (id)
);

alter table answer add constraint FK_Reference_3 foreign key (qid)
      references question (qid) on delete restrict on update restrict;

alter table question add constraint FK_Reference_4 foreign key (itemid)
      references item (itemid) on delete restrict on update restrict;

alter table question add constraint FK_Reference_5 foreign key (subid)
      references subitem (subid) on delete restrict on update restrict;

alter table subitem add constraint FK_Reference_1 foreign key (itemid)
      references item (itemid) on delete restrict on update restrict;

show  tables ;

二、MyEclipse配置数据库连接

数据库创建好后:

 三、创项目建SSH并添加SSH支持

添加顺序:Spring -> Hibernate -> Struts

 

posted @ 2013-03-30 13:21  残星  阅读(302)  评论(0编辑  收藏  举报