package Dao;
import java.sql.*;
import database.DB;
import actionForm.PingFen;
import actionForm.Student;
import actionForm.Tea_Message;
import actionForm.Teacher;
public class TeacherManager {
private static final String insertTeacher="insert into teacher values(null,?,?)";
private static final String insertTeacherPing="insert into score values(null,?,?,?,?)";
private static final String insertStudent="insert into student values(?,?,?,?)";
private static final String uploadfileTeacher="insert into teacherfile values(null,?,?,now())";
private static final String uploadfileStudent="insert into studentfile values(null,?,?,now())";
private static final String addmessage="insert into tea_stu_message values(null,?,?,?,now())";
private static final String addmessage2="insert into allmessage values(null,?,?,now())";
private static TeacherManager instance=new TeacherManager();
private TeacherManager(){}
public static TeacherManager getinstance(){
return instance;
}
public boolean teacherReg(Teacher t){
boolean temp=false;
Connection conn=DB.getConnection();
try{
PreparedStatement pst=conn.prepareStatement(insertTeacher);
pst.setString(1,t.getName());
pst.setString(2, t.getPassword());
pst.executeUpdate();
pst.close();
temp=true;
}catch(SQLException e){
e.printStackTrace();
}
finally{
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return temp;
}
public boolean studentReg(Student t){
boolean temp=false;
Connection conn=DB.getConnection();
try{
PreparedStatement pst=conn.prepareStatement(insertStudent);
pst.setInt(1, t.getId());
pst.setString(2,t.getName());
pst.setString(3, t.getPassword());
pst.setInt(4, t.getTeacherid());
pst.executeUpdate();
pst.close();
temp=true;
}catch(SQLException e){
e.printStackTrace();
}
finally{
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return temp;
}
public boolean teacherUploadFile(String path,String teacher_id){
boolean temp=false;
int tid=Integer.parseInt(teacher_id);
Connection conn=DB.getConnection();
try{
PreparedStatement pst=conn.prepareStatement(uploadfileTeacher);
pst.setString(1,path);
pst.setInt(2,tid);
pst.executeUpdate();
pst.close();
temp=true;
}catch(SQLException e){
e.printStackTrace();
}catch(NumberFormatException ee){
ee.printStackTrace();
}
finally{
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return temp;
}
public boolean studentUploadFile(String path,String student_id){
boolean temp=false;
int tid=Integer.parseInt(student_id);
Connection conn=DB.getConnection();
try{
PreparedStatement pst=conn.prepareStatement(uploadfileStudent);
pst.setString(1,path);
pst.setInt(2,tid);
pst.executeUpdate();
pst.close();
temp=true;
}catch(SQLException e){
e.printStackTrace();
}catch(NumberFormatException ee){
ee.printStackTrace();
}
finally{
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return temp;
}
public int teacherFindId(String rose,String name,String password){
int temp=-1;
String sql = "select * from " + rose + " where "+rose+"_name='"+name+"' and "+rose+"_password='"+password+"'";
Connection conn = DB.getConnection();
Statement pst = null;
System.out.println(sql);
try {
pst = conn.createStatement();
ResultSet rs = pst.executeQuery(sql);
if(rs.next()){
//System.out.println(rs.getString("name"));
temp=rs.getInt("teacher_id");
}
rs.close();
pst.close();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}finally{
try {
if(conn!=null){
conn.close();
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return temp;
}
public int studentFindId(String rose,String name,String password){
int temp=-1;
String sql = "select * from " + rose + " where "+rose+"_name='"+name+"' and "+rose+"_password='"+password+"'";
Connection conn = DB.getConnection();
Statement pst = null;
System.out.println(sql);
try {
pst = conn.createStatement();
ResultSet rs = pst.executeQuery(sql);
if(rs.next()){
//System.out.println(rs.getString("name"));
temp=rs.getInt("student_id");
}
rs.close();
pst.close();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}finally{
try {
if(conn!=null){
conn.close();
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return temp;
}
public boolean teacherAddMessage(Tea_Message t){
boolean temp=false;
Connection conn=DB.getConnection();
try{
PreparedStatement pst=conn.prepareStatement(addmessage);
pst.setString(1,t.getTitle());
pst.setString(2, t.getCont());
pst.setInt(3, t.getTeacherid());
pst.executeUpdate();
pst.close();
temp=true;
}catch(SQLException e){
e.printStackTrace();
}
finally{
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return temp;
}
public boolean teacherAddMessage2(Tea_Message t){
boolean temp=false;
Connection conn=DB.getConnection();
try{
PreparedStatement pst=conn.prepareStatement(addmessage2);
pst.setString(1,t.getTitle());
pst.setString(2, t.getCont());
pst.executeUpdate();
pst.close();
temp=true;
}catch(SQLException e){
e.printStackTrace();
}
finally{
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return temp;
}
public boolean teacherPing(PingFen t){
boolean temp=false;
Connection conn=DB.getConnection();
try{
PreparedStatement pst=conn.prepareStatement(insertTeacherPing);
pst.setInt(1,t.getStudentid());
pst.setInt(2,t.getTeacherid());
pst.setString(3, t.getKemu());
pst.setDouble(4, t.getFenshu());
pst.executeUpdate();
pst.close();
temp=true;
}catch(SQLException e){
e.printStackTrace();
}
finally{
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return temp;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
java、MYSQL作业上传系统
共102个文件
jsp:46个
class:20个
java:20个
3星 · 超过75%的资源 需积分: 12 25 下载量 64 浏览量
2009-08-10
23:37:35
上传
评论
收藏 499KB RAR 举报
温馨提示
一套在java+MySQL开发的线作业提交系统,本人做的毕业设计,希望有用哦!!
资源推荐
资源详情
资源评论
收起资源包目录
java、MYSQL作业上传系统 (102个子文件)
TeacherManager.class 7KB
TeacherUpload.class 2KB
StudentUpload.class 2KB
Login.class 2KB
Tea_Message.class 2KB
UserLogin.class 2KB
UploadFiles.class 2KB
PingFen.class 2KB
Student.class 2KB
TeacherMessage.class 2KB
AdminMessage.class 2KB
TeacherRegAction.class 2KB
StudentRegAction.class 2KB
PingFenAction.class 1KB
Teacher.class 1KB
DB.class 1KB
StudentFile.class 877B
TeacherFile.class 877B
Pro.class 780B
Admin.class 725B
.classpath 530B
TeacherManager.java 7KB
Login.java 1KB
StudentUpload.java 1KB
TeacherUpload.java 1KB
UserLogin.java 1KB
UploadFiles.java 1KB
Tea_Message.java 1KB
PingFen.java 1KB
Student.java 1KB
TeacherRegAction.java 912B
StudentRegAction.java 904B
PingFenAction.java 902B
TeacherMessage.java 898B
AdminMessage.java 896B
Teacher.java 778B
DB.java 651B
Pro.java 599B
StudentFile.java 503B
TeacherFile.java 503B
Admin.java 408B
back.jpg 157KB
back.jpg 157KB
login.jpg 67KB
login.jpg 66KB
login.jpg 66KB
login.jpg 66KB
back2.jpg 38KB
choseStudent.jsp 4KB
teacherPingfen.jsp 3KB
teacherLogin.jsp 3KB
studentLogin.jsp 3KB
adminLogin.jsp 2KB
studentReg.jsp 2KB
teacherLook.jsp 2KB
teacherReg.jsp 2KB
studentMessage.jsp 2KB
message.jsp 2KB
studentLookScore.jsp 2KB
studentAction.jsp 2KB
teacherAction.jsp 2KB
teacherIndex.jsp 2KB
studentPd.jsp 2KB
teacherPd.jsp 2KB
studentIndex.jsp 2KB
studentLook.jsp 2KB
index.jsp 2KB
message.jsp 1KB
studentInfo.jsp 1KB
teacherInfo.jsp 1KB
teacherQuit.jsp 981B
studentQuit.jsp 979B
adminQuit.jsp 977B
teacherHead.jsp 972B
teacherBBS.jsp 955B
teacherInfoInto.jsp 941B
adminStudentsInfo.jsp 941B
adminTeachersInfo.jsp 939B
adminIndex.jsp 934B
studentBBS.jsp 842B
teacherRegOk.jsp 806B
teacherUploadOk.jsp 800B
studentUploadOk.jsp 800B
studentRegOk.jsp 800B
studentHead.jsp 799B
adminUploadOk.jsp 798B
adminHead.jsp 602B
adminError.jsp 425B
studentError.jsp 425B
teacherError.jsp 425B
Head.jsp 307B
Head.jsp 269B
mainHead.jsp 253B
foot.jsp 250B
MANIFEST.MF 39B
.mymetadata 310B
com.genuitec.eclipse.j2eedt.core.prefs 1KB
com.genuitec.eclipse.core.prefs 104B
org.eclipse.core.resources.prefs 88B
.project 1KB
共 102 条
- 1
- 2
资源评论
- Vista_H_Ti2014-05-28还行 整体感觉还是可以的
- q274102800q2015-06-23一般般,没感觉很好
Leo9001
- 粉丝: 2
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于matlab实现字符识别的参考程序,用所用的字体识别率挺高,部分手写的也能识别,但是还不能识别扭曲和倾斜的字符 .rar
- 基于matlab实现指纹识别系统 包括数据库导入、图像选择识别、帮助功能、识别图像可视、gabor滤波可视,实现界面操作.rar
- 基于matlab实现指纹识别,利用gabor滤波器,提取指纹特征,只能呢读取bmp图像.rar
- 基于matlab实现于数字图像相关方法中散斑质量评价
- 基于matlab实现遗传算法和佳点集遗传算法的基本思想和不同点,用遗传算法测试一标准函数 佳点集算法测试一标准函数
- tensorflow-gpu-2.5.1-cp38-cp38-manylinux2010-x86-64.whl
- tensorflow-gpu-2.5.0-cp39-cp39-manylinux2010-x86-64.whl
- tensorflow-gpu-2.5.2-cp39-cp39-manylinux2010-x86-64.whl
- 内含方正小标宋简体、仿宋-Gb2312、黑体、楷体、宋体,五个公文常用字体
- 记忆卡牌游戏源码及可运行文件
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功