# Conflicts: # src/servlet/account/Register.javawlf
commit
074cef61da
File diff suppressed because it is too large
Load Diff
@ -1,22 +1,46 @@
|
||||
package core.process;
|
||||
|
||||
import core.operation.Select;
|
||||
import error.GExcptInit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class C_StudentSelectTeacher extends core.process.Process {
|
||||
public void select(String studentID,String teacherID)throws Exception{
|
||||
public class C_StudentSelectTeacher extends TempProcess {
|
||||
String studentId;
|
||||
String teacherId;
|
||||
|
||||
public void select()throws Exception{
|
||||
if(!check()) throw new GExcptInit("ID Attrs init error!");
|
||||
Select select=new Select();
|
||||
select.setOptions(new HashMap<>());
|
||||
String student_id=studentID;
|
||||
select.addOptions("student_id",student_id);
|
||||
String teacher_id=teacherID;
|
||||
select.addOptions("teacher_id",teacher_id);
|
||||
select.addOptions("student_id",this.getStudentId());
|
||||
select.addOptions("teacher_id",this.getTeacherId());
|
||||
Map<String,Object> options=select.execute(null);
|
||||
}
|
||||
protected boolean check() {
|
||||
if(this.getStudentId()==null||this.getTeacherId()==null)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
public String getTeacherId() {
|
||||
return teacherId;
|
||||
}
|
||||
|
||||
public void setTeacherId(String teacherId) {
|
||||
this.teacherId = teacherId;
|
||||
}
|
||||
|
||||
public String getStudentId() {
|
||||
return studentId;
|
||||
}
|
||||
|
||||
public void setStudentId(String studentId) {
|
||||
this.studentId = studentId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,4 @@
|
||||
package core.process;
|
||||
|
||||
public class C_StudentUploadOpeningReport {
|
||||
}
|
@ -1,33 +1,46 @@
|
||||
package core.process;
|
||||
|
||||
import core.operation.Select;
|
||||
import error.GExcptInit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class C_TeacherSelectStudent extends Process {
|
||||
List<String> list;
|
||||
|
||||
public C_TeacherSelectStudent clone(){
|
||||
C_TeacherSelectStudent tst = new C_TeacherSelectStudent();
|
||||
tst.setInfo( this.getInfo());
|
||||
List<String> list = new ArrayList<>();
|
||||
for(String s:this.list){
|
||||
list.add(new String(s));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public void select(String teacherID,String studentID)throws Exception{
|
||||
public class C_TeacherSelectStudent extends TempProcess {
|
||||
String studentId;
|
||||
String teacherId;
|
||||
|
||||
public void select()throws Exception{
|
||||
if(!check()) throw new GExcptInit("ID Attrs init error!");
|
||||
Select select=new Select();
|
||||
select.setOptions(new HashMap<>());
|
||||
String teacher_id=teacherID;
|
||||
select.addOptions("teacher_id",teacher_id);
|
||||
String student_id=studentID;
|
||||
select.addOptions("student_id",student_id);
|
||||
select.addOptions("teacher_id",this.getTeacherId());
|
||||
select.addOptions("student_id",this.getStudentId());
|
||||
Map<String,Object> options=select.execute(null);
|
||||
}
|
||||
protected boolean check() {
|
||||
if(this.getStudentId()==null||this.getTeacherId()==null)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
public String getTeacherId() {
|
||||
return teacherId;
|
||||
}
|
||||
|
||||
public void setTeacherId(String teacherId) {
|
||||
this.teacherId = teacherId;
|
||||
}
|
||||
|
||||
public String getStudentId() {
|
||||
return studentId;
|
||||
}
|
||||
|
||||
public void setStudentId(String studentId) {
|
||||
this.studentId = studentId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
package error;
|
||||
|
||||
public class GExcptInit extends GExcpt {
|
||||
public GExcptInit(String info) {
|
||||
super(info);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package filter;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.annotation.WebFilter;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
@WebFilter(filterName = "OnlineCheck",urlPatterns = "/home.jsp")
|
||||
public class OnlineCheck implements Filter {
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
if(request.getSession().getAttribute("user")==null){
|
||||
HttpServletResponse response = (HttpServletResponse) resp;
|
||||
response.sendRedirect("/login.jsp");
|
||||
return;
|
||||
}
|
||||
chain.doFilter(req, resp);
|
||||
}
|
||||
|
||||
public void init(FilterConfig config) throws ServletException {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package servlet.Submit;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
public class S_ScoreSubmit extends HttpServlet {
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
super.doPost(request, response);
|
||||
String score = request.getParameter("score");
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package servlet.Submit;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
public class S_StudentFillTopicInformation extends HttpServlet {
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
super.doPost(request, response);
|
||||
String content1=new String(request.getParameter("text").getBytes("ISO8859-1"),"UTF-8");
|
||||
String content2=request.getParameter("score");
|
||||
try {
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package servlet.Submit;
|
||||
|
||||
import core.user.User;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.MultipartConfig;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.Part;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
@WebServlet("/upload")
|
||||
@MultipartConfig
|
||||
//学生id+文件
|
||||
public class S_StudentUploadOpeningReport extends HttpServlet {
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
super.doPost(request, response);
|
||||
User user=(User) request.getSession().getAttribute("user");
|
||||
String student_id=user.getId();
|
||||
|
||||
try {
|
||||
|
||||
//获取上传的文件
|
||||
Part part=request.getPart("file");
|
||||
//获取请求的信息
|
||||
String name=part.getHeader("content-disposition");
|
||||
//获取上传文件的目录
|
||||
String root=request.getServletContext().getRealPath("/upload");
|
||||
|
||||
|
||||
request.setAttribute("info", "上传文件成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
request.setAttribute("info", "上传文件失败");
|
||||
}
|
||||
|
||||
request.getRequestDispatcher("/upload.jsp").forward(request, response);
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package servlet.account;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import core.user.Student;
|
||||
import core.user.User;
|
||||
import core.user.utils.AccountManagement;
|
||||
import error.GExcptAccount;
|
||||
import error.GExcptSQL;
|
||||
|
||||
@WebServlet("/login")
|
||||
public class S_Login extends HttpServlet {
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
String id=request.getParameter("id");
|
||||
String password=request.getParameter("password");
|
||||
User user = null;
|
||||
try {
|
||||
user = AccountManagement.login(id,password);
|
||||
} catch (GExcptSQL | SQLException gExcptSQL) {
|
||||
gExcptSQL.printStackTrace();
|
||||
response.sendRedirect("/op_fail.jsp");
|
||||
return;
|
||||
} catch (GExcptAccount gExcptAccount) {
|
||||
gExcptAccount.printStackTrace();
|
||||
response.sendRedirect("/op_fail.jsp");
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
response.sendRedirect("/op_fail.jsp");
|
||||
return;
|
||||
}
|
||||
request.getSession().setAttribute("user",user);
|
||||
response.sendRedirect("/home.jsp");
|
||||
return;
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
package servlet.account;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import core.user.Student;
|
||||
import core.user.User;
|
||||
import core.user.utils.AccountManagement;
|
||||
import error.GExcptAccount;
|
||||
import error.GExcptSQL;
|
||||
|
||||
@WebServlet("/login")
|
||||
public class login extends HttpServlet {
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
String id=request.getParameter("id");
|
||||
String password=request.getParameter("password");
|
||||
User user = null;
|
||||
try {
|
||||
user = AccountManagement.login(id,password);
|
||||
} catch (GExcptSQL | SQLException gExcptSQL) {
|
||||
gExcptSQL.printStackTrace();
|
||||
} catch (GExcptAccount gExcptAccount) {
|
||||
gExcptAccount.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
request.getSession().setAttribute("user",user);
|
||||
request.getRequestDispatcher("/home.jsp").forward(request,response);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue