栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Java Web综合案例开发流程与技术(学生信息管理) 更新中

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Java Web综合案例开发流程与技术(学生信息管理) 更新中

教务管理系统

1. 数据库设计

学生、教师、课程

学生模块 :

  1. 学生基本信息管理 (sid、name、sex、age、tel、adress、cid)
  2. 班级基本信息管理 (cid、name)
  3. 学生登录账号分配 (id、username[sid]、password)
**新建班级表表:**
create table classes(
	cid int auto_increment not null,
	cname varchar(50) not null,
	primary key(cid)
);

新建学生表:
默认0为女生 , 1为男生;
cid为classes中的 , 学生表的cid必须要在classes中存在(外键约束)

create table student(
	sid varchar(12) not null,
	sname varchar(20) not null,
	sex int not null,
	age int not null,
	tel varchar(15) not null,
	address varchar(80) not null,
	cid int not null,
	foreign key(cid) references classes(cid),
	primary key(sid)
)

创建账号表:

create table account(
	sid varchar(12) not null,
	pwd varchar(20) not null,
	primary key(sid)
);

2. 创建一个Web项目
①名为ems,并且导入三个数据包(mysql、jstl、standard)
②在src中创建一个包 ems.lucene.ems.pojo , 存放实体类
③创建三个实体类 : Student 、Account

Student.java实体类 :
生成setter/getter方法创建有参(无参)构造方法、重写to String(用于测试)

package ems.lucene.ems.pojo;

public class Student {
	private String sid;
	private String sname;
	private int sex;
	private int age;
	private String tel;
	private String address;
	private int cid;
	public String getSid() {
		return sid;
	}
	public void setSid(String sid) {
		this.sid = sid;
	}
	public String getSname() {
		return sname;
	}
	public void setSname(String sname) {
		this.sname = sname;
	}
	public int getSex() {
		return sex;
	}
	public void setSex(int sex) {
		this.sex = sex;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	public String getTel() {
		return tel;
	}
	public void setTel(String tel) {
		this.tel = tel;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public int getCid() {
		return cid;
	}
	public void setCid(int cid) {
		this.cid = cid;
	}
	public Student(String sid, String sname, int sex, int age, String tel, String address, int cid) {
		super();
		this.sid = sid;
		this.sname = sname;
		this.sex = sex;
		this.age = age;
		this.tel = tel;
		this.address = address;
		this.cid = cid;
	}
	public Student() {
		super();
	}
	@Override
	public String toString() {
		return "Student [sid=" + sid + ", sname=" + sname + ", sex=" + sex + ", age=" + age + ", tel=" + tel
				+ ", address=" + address + ", cid=" + cid + "]";
	}
}

Account实体类 :
生成setter/getter方法创建有参(无参)构造方法、重写to String(用于测试)

package ems.lucene.ems.pojo;

public class Account {
	private String sid;
	private String pwd;
	public String getSid() {
		return sid;
	}
	public void setSid(String sid) {
		this.sid = sid;
	}
	public String getPwd() {
		return pwd;
	}
	public Account() {
		super();
	}
	@Override
	public String toString() {
		return "Account [sid=" + sid + ", pwd=" + pwd + "]";
	}
	public Account(String sid, String pwd) {
		super();
		this.sid = sid;
		this.pwd = pwd;
	}
	public void setPwd(String pwd) {
		this.pwd = pwd;
	}
}

Classes.java实体类 :
生成setter/getter方法创建有参(无参)构造方法、重写to String(用于测试)

package ems.lucene.ems.pojo;

public class Classes {
	private int cid;
	private String cname;
	public int getCid() {
		return cid;
	}
	public void setCid(int cid) {
		this.cid = cid;
	}
	public String getCname() {
		return cname;
	}
	public void setCname(String cname) {
		this.cname = cname;
	}
	public Classes(int cid, String cname) {
		super();
		this.cid = cid;
		this.cname = cname;
	}
	public Classes() {
		super();
	}
	@Override
	public String toString() {
		return "Classes [cid=" + cid + ", cname=" + cname + "]";
	}

	
}

在班级表中添加数据测试表:

insert into classes(cname) values('1班');

查询:

select * from classes;


在学生表中添加学生信息:

insert into student values('6019203001','tom','1','20','18811111111','天津市','1');

若班级输入没有添加的班级 , 则会出现报错的情况 , 需要与classes表对应
查询:

select * from student;

创建一个包(com.lucene.ems.dbutil) , 为了与数据库连接:

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/643662.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号