diff --git a/action文件/GoLogin.java b/action文件/GoLogin.java new file mode 100644 index 0000000..1b4eba2 --- /dev/null +++ b/action文件/GoLogin.java @@ -0,0 +1,100 @@ +package com.action; + +import com.dao.AdminDao; +import com.dao.StudentDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpSession; + +public class GoLogin extends ActionSupport { + + //??????Action???????????????????????? + private String Type; + private String Username; + private String Password; + private String Msg; + private String check; + + public String getCheck() { + return check; + } + + public void setCheck(String check) { + this.check = check; + } + + public String getType() { + return Type; + } + public void setType(String type) { + Type = type; + } + public String getUsername() { + return Username; + } + public void setUsername(String username) { + Username = username; + } + public String getPassword() { + return Password; + } + public void setPassword(String password) { + Password = password; + } + public String getMsg() { + return Msg; + } + public void setMsg(String msg) { + Msg = msg; + } + /** + * ϾǻȡϢ * */ + public String execute() throws Exception { + + + + + if(Type.equals("ϵͳԱ")) + { + if (null == new AdminDao().CheckLogin(Username, Password)) { + Msg = "ϵͳΪհ"; + return INPUT; + } + else + { + //???ID + String Admin_ID=new AdminDao().CheckLogin(Username, Password); + //????session + HttpSession session = ServletActionContext.getRequest().getSession(); + session.setAttribute("id", Admin_ID); + session.setAttribute("type", "1"); + return SUCCESS; + } + } + + else if(Type.equals("ѧ")) + { + if (null == new StudentDao().CheckLogin(Username, Password)) { + Msg = "ѧû"; + return INPUT; + } + else + { + //???ID + String Student_ID=new StudentDao().CheckLogin(Username, Password); + //????session + HttpSession session = ServletActionContext.getRequest().getSession(); + session.setAttribute("id", Student_ID); + session.setAttribute("type", "3"); + return SUCCESS; + } + } + else + { + Msg = "û"; + return INPUT; + } + + } +} diff --git a/action文件/LogAdd.java b/action文件/LogAdd.java new file mode 100644 index 0000000..8589c02 --- /dev/null +++ b/action文件/LogAdd.java @@ -0,0 +1,66 @@ +package com.action; + +import com.bean.StudentBean; +import com.dao.StudentDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; + + +public class LogAdd extends ActionSupport { + + //Actionڷװû + + private String Student_ID; + public String getStudent_ID() { + return Student_ID; + } + public void setStudent_ID(String studentID) { + Student_ID = studentID; + } + private StudentBean cnbean; + public StudentBean getCnbean() { + return cnbean; + } + public void setCnbean(StudentBean cnbean) { + this.cnbean = cnbean; + } + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + + //ѯ + cnbean=new StudentDao().GetBean(Integer.parseInt(Student_ID)); + + return SUCCESS; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/LogAddSave.java b/action文件/LogAddSave.java new file mode 100644 index 0000000..9dbcca4 --- /dev/null +++ b/action文件/LogAddSave.java @@ -0,0 +1,87 @@ +package com.action; + +import com.bean.LogBean; +import com.dao.LogDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; + + +public class LogAddSave extends ActionSupport { + + //Actionڷװû + private String Log_Date ; + private String Log_Remark ; + + public String getLog_Date() { + return Log_Date; + } + + public void setLog_Date(String logDate) { + Log_Date = logDate; + } + + public String getLog_Remark() { + return Log_Remark; + } + + public void setLog_Remark(String logRemark) { + Log_Remark = logRemark; + } + + private String Log_StudentID; + public String getLog_StudentID() { + return Log_StudentID; + } + + public void setLog_StudentID(String logStudentID) { + Log_StudentID = logStudentID; + } + + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + + // + LogBean cnbean=new LogBean(); + cnbean.setLog_StudentID(Integer.parseInt(Log_StudentID)); + cnbean.setLog_TeacherID(Integer.parseInt(session.getAttribute("id").toString())); + cnbean.setLog_Date(Log_Date); + cnbean.setLog_Remark(Log_Remark); + + new LogDao().Add(cnbean); + + //ת + out.print(""); + out.flush();out.close();return null; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/MyLog.java b/action文件/MyLog.java new file mode 100644 index 0000000..06da6ae --- /dev/null +++ b/action文件/MyLog.java @@ -0,0 +1,62 @@ +package com.action; + +import com.bean.TBBean; +import com.dao.TBDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; +import java.util.List; + + +public class MyLog extends ActionSupport { + + //Actionڷװû + private List list; + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + + + //ѯ + list=new TBDao().GetList("TB_TeacherID="+session.getAttribute("id"),"Building_Name"); + + return SUCCESS; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/MyLogList.java b/action文件/MyLogList.java new file mode 100644 index 0000000..a2676ce --- /dev/null +++ b/action文件/MyLogList.java @@ -0,0 +1,113 @@ +package com.action; + +import com.bean.DomitoryBean; +import com.bean.LogBean; +import com.dao.DomitoryDao; +import com.dao.LogDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; +import java.util.List; + + +public class MyLogList extends ActionSupport { + + //Actionڷװû + private List list; + public List getList() { + return list; + } + public void setList(List list) { + this.list = list; + } + + + private String Building_ID; + public String getBuilding_ID() { + return Building_ID; + } + public void setBuilding_ID(String buildingID) { + Building_ID = buildingID; + } + private List domitorylist; + public List getDomitorylist() { + return domitorylist; + } + public void setDomitorylist(List domitorylist) { + this.domitorylist = domitorylist; + } + + private String SearchRow; + private String SearchKey; + public String getSearchRow() { + return SearchRow; + } + public void setSearchRow(String searchRow) { + SearchRow = searchRow; + } + public String getSearchKey() { + return SearchKey; + } + public void setSearchKey(String searchKey) { + SearchKey = searchKey; + } + private String Domitory_ID; + + public String getDomitory_ID() { + return Domitory_ID; + } + public void setDomitory_ID(String domitoryID) { + Domitory_ID = domitoryID; + } + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + + //ѯ + String strWhere="Student_State='ס' and Building_ID="+Building_ID; + if(!(isInvalid(SearchKey))) + { + strWhere+=" and "+SearchRow+"='"+SearchKey+"'"; + } + if(!(isInvalid(Domitory_ID))) + { + strWhere+=" and Domitory_ID='"+Domitory_ID+"'"; + } + //ѯ + list=new LogDao().GetList(strWhere,"Log_Date desc"); + + //ѯ + domitorylist=new DomitoryDao().GetList("Domitory_BuildingID="+Building_ID,"Domitory_Name"); + + return SUCCESS; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/MyStudent.java b/action文件/MyStudent.java new file mode 100644 index 0000000..40b68d1 --- /dev/null +++ b/action文件/MyStudent.java @@ -0,0 +1,62 @@ +package com.action; + +import com.bean.TBBean; +import com.dao.TBDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; +import java.util.List; + + +public class MyStudent extends ActionSupport { + + //Actionڷװû + private List list; + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + + + //ѯ + list=new TBDao().GetList("TB_TeacherID="+session.getAttribute("id"),"Building_Name"); + + return SUCCESS; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/MyStudentList.java b/action文件/MyStudentList.java new file mode 100644 index 0000000..a5ab3ac --- /dev/null +++ b/action文件/MyStudentList.java @@ -0,0 +1,111 @@ +package com.action; + +import com.bean.DomitoryBean; +import com.bean.StudentBean; +import com.dao.DomitoryDao; +import com.dao.StudentDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; +import java.util.List; + + +public class MyStudentList extends ActionSupport { + + //Actionڷװû + private List list; + public List getList() { + return list; + } + public void setList(List list) { + this.list = list; + } + private String Building_ID; + public String getBuilding_ID() { + return Building_ID; + } + public void setBuilding_ID(String buildingID) { + Building_ID = buildingID; + } + private List domitorylist; + public List getDomitorylist() { + return domitorylist; + } + public void setDomitorylist(List domitorylist) { + this.domitorylist = domitorylist; + } + + private String SearchRow; + private String SearchKey; + public String getSearchRow() { + return SearchRow; + } + public void setSearchRow(String searchRow) { + SearchRow = searchRow; + } + public String getSearchKey() { + return SearchKey; + } + public void setSearchKey(String searchKey) { + SearchKey = searchKey; + } + private String Domitory_ID; + + public String getDomitory_ID() { + return Domitory_ID; + } + public void setDomitory_ID(String domitoryID) { + Domitory_ID = domitoryID; + } + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + + //ѯ + String strWhere="Student_State='ס' and Building_ID="+Building_ID; + if(!(isInvalid(SearchKey))) + { + strWhere+=" and "+SearchRow+"='"+SearchKey+"'"; + } + if(!(isInvalid(Domitory_ID))) + { + strWhere+=" and Domitory_ID='"+Domitory_ID+"'"; + } + //ѯ + list=new StudentDao().GetList(strWhere,"Domitory_Name"); + + //ѯ + domitorylist=new DomitoryDao().GetList("Domitory_BuildingID="+Building_ID,"Domitory_Name"); + + return SUCCESS; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/Notice.java b/action文件/Notice.java new file mode 100644 index 0000000..cd786f1 --- /dev/null +++ b/action文件/Notice.java @@ -0,0 +1,76 @@ +package com.action; + +import com.bean.NoticeBean; +import com.dao.NoticeDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; +import java.util.List; + +public class Notice extends ActionSupport { + private String Msg1; + private String Msg2; + + public String getMsg2() { + return Msg2; + } + + public void setMsg2(String msg2) { + Msg2 = msg2; + } + + public String getMsg1() { + return Msg1; + } + public void setMsg1(String msg1) { + Msg1 = msg1; + } + private List list; + public List getList() { + return list; + } + public void setList(List list) { + this.list = list; + } + private List repairlist; + public List getRepairlist() { + return list; + } + public void setRepairlist(List list) { + this.list = list; + } + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response= ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + //ѯ + list= new NoticeDao().GetBean(); + Msg1= String.valueOf(list.get(0)); + Msg2= String.valueOf(list.get(1)); + + return SUCCESS; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } +} diff --git a/action文件/OutList.java b/action文件/OutList.java new file mode 100644 index 0000000..f5cc42d --- /dev/null +++ b/action文件/OutList.java @@ -0,0 +1,60 @@ +package com.action; + +import com.bean.OutBean; +import com.dao.OutDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; +import java.util.List; + + +public class OutList extends ActionSupport { + + //Actionڷװû + private List list; + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + //ѯ + list=new OutDao().GetList("","o.Out_Date desc"); + + return SUCCESS; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/PasswordUpdateSave.java b/action文件/PasswordUpdateSave.java new file mode 100644 index 0000000..55c273e --- /dev/null +++ b/action文件/PasswordUpdateSave.java @@ -0,0 +1,138 @@ +package com.action; + +import com.bean.AdminBean; +import com.bean.StudentBean; +import com.bean.TeacherBean; +import com.dao.AdminDao; +import com.dao.StudentDao; +import com.dao.TeacherDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; + + +public class PasswordUpdateSave extends ActionSupport { + + //Actionڷװû + private String Password; + private String Password2; + private String Msg; + public String getPassword() { + return Password; + } + + public void setPassword(String password) { + Password = password; + } + + public String getPassword2() { + return Password2; + } + + public void setPassword2(String password2) { + Password2 = password2; + } + + public String getMsg() { + return Msg; + } + + public void setMsg(String msg) { + Msg = msg; + } + + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + String type=session.getAttribute("type").toString(); + if(type.equals("1"))//У԰Ա + { + //ѯԭǷȷ + if (new AdminDao().CheckPassword(session.getAttribute("id").toString(), Password)) { + //޸ + AdminBean cnbean=new AdminBean(); + cnbean=new AdminDao().GetBean(Integer.parseInt(session.getAttribute("id").toString())); + cnbean.setAdmin_Password(Password2); + new AdminDao().Update(cnbean); + out.print(""); + out.flush();out.close();return null; + } + else + { + Msg = "û"; + return INPUT; + } + } + else if(type.equals("2"))//¥Ա + { + //ѯԭǷȷ + if (new TeacherDao().CheckPassword(session.getAttribute("id").toString(), Password)) { + //޸ + TeacherBean cnbean=new TeacherBean(); + cnbean=new TeacherDao().GetBean(Integer.parseInt(session.getAttribute("id").toString())); + cnbean.setTeacher_Password(Password2); + new TeacherDao().Update(cnbean); + out.print(""); + out.flush();out.close();return null; + } + else + { + Msg = "û"; + return INPUT; + } + } + else if(type.equals("3"))//ѧ + { + //ѯԭǷȷ + if (new StudentDao().CheckPassword(session.getAttribute("id").toString(), Password)) { + //޸ + StudentBean cnbean=new StudentBean(); + cnbean=new StudentDao().GetBean(Integer.parseInt(session.getAttribute("id").toString())); + cnbean.setStudent_Password(Password2); + new StudentDao().Update(cnbean); + out.print(""); + out.flush();out.close();return null; + } + else + { + Msg = "û"; + return INPUT; + } + } + else + { + out.print(""); + out.flush();out.close();return null; + } + + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/Quit.java b/action文件/Quit.java new file mode 100644 index 0000000..535662c --- /dev/null +++ b/action文件/Quit.java @@ -0,0 +1,28 @@ +package com.action; + +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpSession; + + +public class Quit extends ActionSupport { + + + //ûexecute + public String execute() throws Exception { + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + session.removeAttribute("id"); + + return SUCCESS; + + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/RepairAdd.java b/action文件/RepairAdd.java new file mode 100644 index 0000000..4eeea47 --- /dev/null +++ b/action文件/RepairAdd.java @@ -0,0 +1,141 @@ +package com.action; + +import com.bean.Repair_addBean; +import com.dao.RepairDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; +import java.text.SimpleDateFormat; +import java.util.Date; +public class RepairAdd extends ActionSupport { + + //Actionڷװû + private int repair_id ; + private String repair_address ; + private String repair_info ; + private String repair_cost; + private String repair_time; + private String repair_status ; + private String repair_tel ; + + public int getRepair_id() { + return repair_id; + } + + public void setRepair_id(int repair_id) { + this.repair_id = repair_id; + } + public String getRepair_address() { + return repair_address; + } + + public void setRepair_address(String repair_address) { + this.repair_address = repair_address; + } + + public String getRepair_info() { + return repair_info; + } + + public void setRepair_info(String repair_info) { + this.repair_info = repair_info; + } + + public String getRepair_cost() { + return repair_cost; + } + + public void setRepair_cost(String repair_cost) { + this.repair_cost = repair_cost; + } + + public String getRepair_time() { + return repair_time; + } + + public void setRepair_time(String repair_time) { + this.repair_time = repair_time; + } + + public String getRepair_status() { + return repair_status; + } + + public void setRepair_status(String repair_status) { + this.repair_status = repair_status; + } + + public String getRepair_tel() { + return repair_tel; + } + + public void setRepair_tel(String repair_tel) { + this.repair_tel = repair_tel; + } + + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + + //ѯûǷ +// List list=new StudentDao().GetList("Student_Username='"+Student_Username+"'", ""); +// if(list.size()>0) +// { +// out.print(""); +// out.flush();out.close();return null; +// } + // + + Repair_addBean cnbean=new Repair_addBean(); +//newڶ + long l = System.currentTimeMillis(); + Date date = new Date(l); +//תʽ + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + repair_time=dateFormat.format(date); + repair_cost="25"; + repair_status="ά"; + // Repair_addBean cnbean=new Repair_addBean(); + cnbean.setRepair_id(repair_id); + cnbean.setRepair_address(repair_address); + cnbean.setRepair_info(repair_info); + cnbean.setRepair_tel(repair_tel); + // cnbean.setRepair_time(repair_time); + //cnbean.setRepair_cost(repair_cost); + cnbean.setRepair_status(repair_status); + new RepairDao().Add(cnbean); + + //ת + out.print(""); + out.flush();out.close();return null; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/RepairList.java b/action文件/RepairList.java new file mode 100644 index 0000000..d7b4998 --- /dev/null +++ b/action文件/RepairList.java @@ -0,0 +1,63 @@ +package com.action; + +import com.bean.Repair_addBean; +import com.dao.RepairDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; +import java.util.List; + +public class RepairList extends ActionSupport { + + private int repair_id; + + + public int getRepair_id() { + return repair_id; + } + + public void setRepair_id(int studentid) { + repair_id = repair_id; + } + + private List list; + public List getList() { return list; + } + public void setList(List list) { + this.list = list; + } + + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response= ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + //ѯ + // list=new RepairDao(List)().GetBean(repair_id); + + list=new RepairDao().GetList("strwhere","repair_id"); + return SUCCESS; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } +} diff --git a/action文件/RepairManager.java b/action文件/RepairManager.java new file mode 100644 index 0000000..5868d03 --- /dev/null +++ b/action文件/RepairManager.java @@ -0,0 +1,94 @@ +package com.action; + +import com.bean.Repair_addBean; +import com.dao.RepairDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; +import java.util.List; + + +public class RepairManager extends ActionSupport { + + //下面是Action内用于封装用户请求参数的属性 + private List list; + public List getList() { + return list; + } + public void setList(List list) { + this.list = list; + } + private String SearchRow; + private String SearchKey; + public String getSearchRow() { + return SearchRow; + } + public void setSearchRow(String searchRow) { + SearchRow = searchRow; + } + public String getSearchKey() { + return SearchKey; + } + public void setSearchKey(String searchKey) { + SearchKey = searchKey; + } + // private List buildinglist; + // public List getBuildinglist() { + // return buildinglist; + //} + // public void setBuildinglist(List buildinglist) { + // this.buildinglist = buildinglist; + // } + + //处理用户请求的execute方法 + public String execute() throws Exception { + + //解决乱码,用于页面输出 + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //创建session对象 + HttpSession session = ServletActionContext.getRequest().getSession(); + //验证是否正常登录 + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + //查询条件 + String strWhere="1=1"; + if(!(isInvalid(SearchKey))) + { + strWhere+=" and "+SearchRow+"='"+SearchKey+"'"; + } + // if(!(isInvalid(Integer.toString(repair_id)))) + // { + // strWhere+=" and repair_id='"+repair_id+"'"; + // } + + //查询所有楼宇 + //list=new RepairDao().GetList("","repair_id"); + + //查询所有 + list=new RepairDao().GetList(strWhere,"repair_tel"); + + return SUCCESS; + + } + + //判断是否空值 + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + //测试 + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/RepairUpdate.java b/action文件/RepairUpdate.java new file mode 100644 index 0000000..c1491d9 --- /dev/null +++ b/action文件/RepairUpdate.java @@ -0,0 +1,72 @@ +package com.action; + +import com.bean.Repair_addBean; +import com.dao.RepairDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; + + +public class RepairUpdate extends ActionSupport { + + //下面是Action内用于封装用户请求参数的属性 + private int repair_id; + private Repair_addBean cnbean; + public int getRepair_id() { + System.out.println(repair_id); + return repair_id; + } + + public void setRepair_id(int studentid) { + repair_id = studentid; + } + + public Repair_addBean getCnbean() { return cnbean; + } + + public void setCnbean(Repair_addBean cnbean) { + this.cnbean = cnbean; + } + + + //处理用户请求的execute方法 + public String execute() throws Exception { + + //解决乱码,用于页面输出 + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //创建session对象 + HttpSession session = ServletActionContext.getRequest().getSession(); + //验证是否正常登录 + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + + //查询所有楼宇 + //list=new RepairDao().GetList("","repair_id"); + //查询 + cnbean=new RepairDao().GetBean(repair_id); + System.out.println(repair_id); + return SUCCESS; + + } + + //判断是否空值 + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + //测试 + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/RepairUpdateSave.java b/action文件/RepairUpdateSave.java new file mode 100644 index 0000000..491c454 --- /dev/null +++ b/action文件/RepairUpdateSave.java @@ -0,0 +1,142 @@ +package com.action; + +import com.bean.Repair_addBean; +import com.dao.RepairDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; + + +public class RepairUpdateSave extends ActionSupport { + + //下面是Action内用于封装用户请求参数的属性 + private int repair_id; + private String repair_address; + private String repair_info; + private String repair_cost; + private String repair_tel; + private String repair_status; + private String repair_time; + public int getRepair_id() { + + return repair_id; + } + + public void setRepair_id(int cookID) { + this.repair_id = cookID; + } + + + public String getRepair_time() { + return repair_time; + } + + public void setRepair_time(String repair_time) { + this.repair_time = repair_time; + } + + public String getRepair_address() { + return repair_address; + } + + public void setRepair_address(String repair_address) { + this.repair_address = repair_address; + } + + public String getRepair_info() { + return repair_info; + } + + public void setRepair_info(String repair_info) { + this.repair_info = repair_info; + } + + public String getRepair_cost() { + return repair_cost; + } + + public void setRepair_cost(String repair_cost) { + this.repair_cost = repair_cost; + } + + public String getRepair_tel() { + return repair_tel; + } + + public void setRepair_tel(String repair_tel) { + this.repair_tel = repair_tel; + } + + public String getRepair_status() { + return repair_status; + } + + public void setRepair_status(String cookStatus) { + this.repair_status = cookStatus; + } + //处理用户请求的execute方法 + public String execute() throws Exception { + System.out.println(repair_id); + + //解决乱码,用于页面输出 + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //创建session对象 + HttpSession session = ServletActionContext.getRequest().getSession(); + //验证是否正常登录 + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + + //查询用户名是否存在 + //List list=new RepairDao().GetList("Teacher_Username='"+Teacher_Username+"' and Teacher_ID!="+Teacher_ID, ""); + // if(list.size()>0) + // { + // out.print(""); + // out.flush();out.close();return null; + // } + //修改 + + Repair_addBean cnbean=new Repair_addBean(); + + cnbean=new RepairDao().GetBean(repair_id); + + cnbean.setRepair_id(repair_id); + + //cnbean.setRepair_address(repair_address); + //cnbean.setRepair_info(repair_info); + // cnbean.setRepair_cost(rs.getString("repair_cost")); + //cnbean.setRepair_tel(repair_tel); + // cnbean=new RepairDao().GetBean(repair_id); + cnbean.setRepair_status(repair_status); + // if(!(isInvalid(repair_status))) + //{ + // cnbean.setRepair_status(repair_status); + // } + new RepairDao().Update(cnbean); + + //跳转 + out.print(""); + out.flush();out.close();return null; + + } + + //判断是否空值 + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + //测试 + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/StudentAddSave.java b/action文件/StudentAddSave.java new file mode 100644 index 0000000..d2d8b2c --- /dev/null +++ b/action文件/StudentAddSave.java @@ -0,0 +1,114 @@ +package com.action; + +import com.bean.StudentBean; +import com.dao.StudentDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; +import java.util.List; + + +public class StudentAddSave extends ActionSupport { + + //Actionڷװû + private String Student_Username ; + private String Student_Password ; + private String Student_Name ; + private String Student_Sex ; + private String Student_Class ; + public String getStudent_Username() { + return Student_Username; + } + + public void setStudent_Username(String studentUsername) { + Student_Username = studentUsername; + } + + public String getStudent_Password() { + return Student_Password; + } + + public void setStudent_Password(String studentPassword) { + Student_Password = studentPassword; + } + + public String getStudent_Name() { + return Student_Name; + } + + public void setStudent_Name(String studentName) { + Student_Name = studentName; + } + + public String getStudent_Sex() { + return Student_Sex; + } + + public void setStudent_Sex(String studentSex) { + Student_Sex = studentSex; + } + + public String getStudent_Class() { + return Student_Class; + } + + public void setStudent_Class(String studentClass) { + Student_Class = studentClass; + } + + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + + //ѯûǷ + List list=new StudentDao().GetList("Student_Username='"+Student_Username+"'", ""); + if(list.size()>0) + { + out.print(""); + out.flush();out.close();return null; + } + // + StudentBean cnbean=new StudentBean(); + cnbean.setStudent_Username(Student_Username); + cnbean.setStudent_Password(Student_Password); + cnbean.setStudent_Name(Student_Name); + cnbean.setStudent_Sex(Student_Sex); + cnbean.setStudent_Class(Student_Class); + cnbean.setStudent_State("δס"); + cnbean.setStudent_DomitoryID(1); + new StudentDao().Add(cnbean); + + //ת + out.print(""); + out.flush();out.close();return null; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/StudentDel.java b/action文件/StudentDel.java new file mode 100644 index 0000000..83c8216 --- /dev/null +++ b/action文件/StudentDel.java @@ -0,0 +1,59 @@ +package com.action; + +import com.dao.StudentDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; + + +public class StudentDel extends ActionSupport { + + //Actionڷװû + private int Student_ID ; + public int getStudent_ID() { + return Student_ID; + } + + public void setStudent_ID(int userID) { + Student_ID = userID; + } + + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + + + //ɾ + new StudentDao().Delete(Student_ID); + return SUCCESS; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/StudentManager.java b/action文件/StudentManager.java new file mode 100644 index 0000000..f087ef4 --- /dev/null +++ b/action文件/StudentManager.java @@ -0,0 +1,110 @@ +package com.action; + +import com.bean.StudentBean; +import com.dao.StudentDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; +import java.util.List; + + +public class StudentManager extends ActionSupport { + + //Actionڷװû + private List list; + private int a; + + public int getA() { + return a; + } + + public void setA(int a) { + this.a = a; + } + + public List getList() { + return list; + } + public void setList(List list) { + this.list = list; + } + private String SearchRow; + private String SearchKey; + private String State; + public String getState() { + return State; + } + public void setState(String state) { + State = state; + } + public String getSearchRow() { + return SearchRow; + } + public void setSearchRow(String searchRow) { + SearchRow = searchRow; + } + public String getSearchKey() { + return SearchKey; + } + public void setSearchKey(String searchKey) { + SearchKey = searchKey; + } + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + //ѯ + String strWhere="1=1"; + if(!(isInvalid(SearchKey))) + { + strWhere+=" and "+SearchRow+"='"+SearchKey+"'"; + } + if(!(isInvalid(State))) + { + strWhere+=" and Student_State='"+State+"'"; + } + else + {strWhere+="and Student_State='ס'";} + //ѯ¥ + //List list; + if(session.getAttribute("number111")==null){ + + a=1; + list=new StudentDao().GetAllList1(a);} + else + + //ѯ + list=new StudentDao().GetList("","Student_Name"); + + return SUCCESS; + + } + + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/StudentUpdate.java b/action文件/StudentUpdate.java new file mode 100644 index 0000000..66041a8 --- /dev/null +++ b/action文件/StudentUpdate.java @@ -0,0 +1,68 @@ +package com.action; + +import com.bean.StudentBean; +import com.dao.StudentDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; + + +public class StudentUpdate extends ActionSupport { + + //Actionڷװû + private String Student_ID; + private StudentBean cnbean; + public String getStudent_ID() { + return Student_ID; + } + + public void setStudent_ID(String studentID) { + Student_ID = studentID; + } + + public StudentBean getCnbean() { + return cnbean; + } + + public void setCnbean(StudentBean cnbean) { + this.cnbean = cnbean; + } + + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + + //ѯ + cnbean=new StudentDao().GetBean(Integer.parseInt(Student_ID)); + return SUCCESS; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/StudentUpdateSave.java b/action文件/StudentUpdateSave.java new file mode 100644 index 0000000..8991154 --- /dev/null +++ b/action文件/StudentUpdateSave.java @@ -0,0 +1,126 @@ +package com.action; + +import com.bean.StudentBean; +import com.dao.StudentDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; +import java.util.List; + + +public class StudentUpdateSave extends ActionSupport { + + //Actionڷװû + private String Student_ID ; + private String Student_Username ; + private String Student_Password ; + private String Student_Name ; + private String Student_Sex ; + private String Student_Class ; + public String getStudent_ID() { + return Student_ID; + } + + public void setStudent_ID(String studentID) { + Student_ID = studentID; + } + + public String getStudent_Username() { + return Student_Username; + } + + public void setStudent_Username(String studentUsername) { + Student_Username = studentUsername; + } + + public String getStudent_Password() { + return Student_Password; + } + + public void setStudent_Password(String studentPassword) { + Student_Password = studentPassword; + } + + public String getStudent_Name() { + return Student_Name; + } + + public void setStudent_Name(String studentName) { + Student_Name = studentName; + } + + public String getStudent_Sex() { + return Student_Sex; + } + + public void setStudent_Sex(String studentSex) { + Student_Sex = studentSex; + } + + public String getStudent_Class() { + return Student_Class; + } + + public void setStudent_Class(String studentClass) { + Student_Class = studentClass; + } + + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + + //ѯûǷ + List list=new StudentDao().GetList("Student_Username='"+Student_Username+"' and Student_ID!="+Student_ID, ""); + if(list.size()>0) + { + out.print(""); + out.flush();out.close();return null; + } + //޸ + + StudentBean cnbean=new StudentBean(); + cnbean=new StudentDao().GetAllBean(Integer.parseInt(Student_ID)); + cnbean.setStudent_Username(Student_Username); + cnbean.setStudent_Name(Student_Name); + cnbean.setStudent_Sex(Student_Sex); + cnbean.setStudent_Class(Student_Class); + if(!(isInvalid(Student_Password))) + { + cnbean.setStudent_Password(Student_Password); + } + new StudentDao().Update(cnbean); + + //ת + out.print(""); + out.flush();out.close();return null; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/TeacherAddSave.java b/action文件/TeacherAddSave.java new file mode 100644 index 0000000..6241897 --- /dev/null +++ b/action文件/TeacherAddSave.java @@ -0,0 +1,111 @@ +package com.action; + +import com.bean.TeacherBean; +import com.dao.TeacherDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; +import java.util.List; + + +public class TeacherAddSave extends ActionSupport { + + //Actionڷװû + private String Teacher_Username ; + private String Teacher_Password ; + private String Teacher_Name ; + private String Teacher_Sex ; + private String Teacher_Tel ; + + public String getTeacher_Username() { + return Teacher_Username; + } + + public void setTeacher_Username(String cookUsername) { + Teacher_Username = cookUsername; + } + + public String getTeacher_Password() { + return Teacher_Password; + } + + public void setTeacher_Password(String cookPassword) { + Teacher_Password = cookPassword; + } + + public String getTeacher_Name() { + return Teacher_Name; + } + + public void setTeacher_Name(String cookName) { + Teacher_Name = cookName; + } + + public String getTeacher_Sex() { + return Teacher_Sex; + } + + public void setTeacher_Sex(String cookSex) { + Teacher_Sex = cookSex; + } + + public String getTeacher_Tel() { + return Teacher_Tel; + } + + + + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + + //ѯûǷ + List list=new TeacherDao().GetList("Teacher_Username='"+Teacher_Username+"'", ""); + if(list.size()>0) + { + out.print(""); + out.flush();out.close();return null; + } + // + TeacherBean cnbean=new TeacherBean(); + cnbean.setTeacher_Username(Teacher_Username); + cnbean.setTeacher_Password(Teacher_Password); + cnbean.setTeacher_Name(Teacher_Name); + cnbean.setTeacher_Sex(Teacher_Sex); + cnbean.setTeacher_Tel(Teacher_Tel); + + new TeacherDao().Add(cnbean); + //ת + out.print(""); + out.flush();out.close();return null; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/TeacherDel.java b/action文件/TeacherDel.java new file mode 100644 index 0000000..0ec64d3 --- /dev/null +++ b/action文件/TeacherDel.java @@ -0,0 +1,60 @@ +package com.action; + +import com.dao.TeacherDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; + + +public class TeacherDel extends ActionSupport { + + //Actionڷװû + + private int Teacher_ID; + + + public int getTeacher_ID() { return Teacher_ID; } + + public void setTeacher_ID(int userID) { + Teacher_ID= userID; + } + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + + + //ɾ + new TeacherDao().Delete(Teacher_ID); + + return SUCCESS; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/TeacherManager.java b/action文件/TeacherManager.java new file mode 100644 index 0000000..a6e91cf --- /dev/null +++ b/action文件/TeacherManager.java @@ -0,0 +1,78 @@ +package com.action; + +import com.bean.TeacherBean; +import com.dao.TeacherDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; +import java.util.List; + + +public class TeacherManager extends ActionSupport { + + //Actionڷװû + private List list; + public List getList() { + return list; + } + public void setList(List list) { + this.list = list; + } + private String SearchRow; + private String SearchKey; + public String getSearchRow() { + return SearchRow; + } + public void setSearchRow(String searchRow) { + SearchRow = searchRow; + } + public String getSearchKey() { + return SearchKey; + } + public void setSearchKey(String searchKey) { + SearchKey = searchKey; + } + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + //ѯ + String strWhere="1=1"; + if(!(isInvalid(SearchKey))) + { + strWhere+=" and "+SearchRow+"='"+SearchKey+"'"; + } + //ѯ + list=new TeacherDao().GetList(strWhere,"Teacher_Name"); + + return SUCCESS; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/TeacherUpdate.java b/action文件/TeacherUpdate.java new file mode 100644 index 0000000..09b34b9 --- /dev/null +++ b/action文件/TeacherUpdate.java @@ -0,0 +1,68 @@ +package com.action; + +import com.bean.TeacherBean; +import com.dao.TeacherDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; + + +public class TeacherUpdate extends ActionSupport { + + //Actionڷװû + private String Teacher_ID; + private TeacherBean cnbean; + public String getTeacher_ID() { + return Teacher_ID; + } + + public void setTeacher_ID(String studentID) { + Teacher_ID = studentID; + } + + public TeacherBean getCnbean() { + return cnbean; + } + + public void setCnbean(TeacherBean cnbean) { + this.cnbean = cnbean; + } + + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + + //ѯ + cnbean=new TeacherDao().GetBean(Integer.parseInt(Teacher_ID)); + return SUCCESS; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +} diff --git a/action文件/TeacherUpdateSave.java b/action文件/TeacherUpdateSave.java new file mode 100644 index 0000000..a196d1f --- /dev/null +++ b/action文件/TeacherUpdateSave.java @@ -0,0 +1,126 @@ +package com.action; + +import com.bean.TeacherBean; +import com.dao.TeacherDao; +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.PrintWriter; +import java.util.List; + + +public class TeacherUpdateSave extends ActionSupport { + + //Actionڷװû + private String Teacher_ID ; + private String Teacher_Username ; + private String Teacher_Password ; + private String Teacher_Name ; + private String Teacher_Sex ; + private String Teacher_Tel ; + public String getTeacher_ID() { + return Teacher_ID; + } + + public void setTeacher_ID(String cookID) { + Teacher_ID = cookID; + } + + public String getTeacher_Username() { + return Teacher_Username; + } + + public void setTeacher_Username(String cookUsername) { + Teacher_Username = cookUsername; + } + + public String getTeacher_Password() { + return Teacher_Password; + } + + public void setTeacher_Password(String cookPassword) { + Teacher_Password = cookPassword; + } + + public String getTeacher_Name() { + return Teacher_Name; + } + + public void setTeacher_Name(String cookName) { + Teacher_Name = cookName; + } + + public String getTeacher_Sex() { + return Teacher_Sex; + } + + public void setTeacher_Sex(String cookSex) { + Teacher_Sex = cookSex; + } + + public String getTeacher_Tel() { + return Teacher_Tel; + } + + public void setTeacher_Tel(String cookTel) { + Teacher_Tel = cookTel; + } + + //ûexecute + public String execute() throws Exception { + + //룬ҳ + HttpServletResponse response=null; + response=ServletActionContext.getResponse(); + response.setContentType("text/html;charset=UTF-8"); + response.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + + //session + HttpSession session = ServletActionContext.getRequest().getSession(); + //֤Ƿ¼ + if(session.getAttribute("id")==null){ + out.print(""); + out.flush();out.close();return null; + } + + //ѯûǷ + List list=new TeacherDao().GetList("Teacher_Username='"+Teacher_Username+"' and Teacher_ID!="+Teacher_ID, ""); + if(list.size()>0) + { + out.print(""); + out.flush();out.close();return null; + } + //޸ + + TeacherBean cnbean=new TeacherBean(); + cnbean=new TeacherDao().GetBean(Integer.parseInt(Teacher_ID)); + cnbean.setTeacher_Username(Teacher_Username); + cnbean.setTeacher_Name(Teacher_Name); + cnbean.setTeacher_Sex(Teacher_Sex); + cnbean.setTeacher_Tel(Teacher_Tel); + if(!(isInvalid(Teacher_Password))) + { + cnbean.setTeacher_Password(Teacher_Password); + } + new TeacherDao().Update(cnbean); + + //ת + out.print(""); + out.flush();out.close();return null; + + } + + //жǷֵ + private boolean isInvalid(String value) { + return (value == null || value.length() == 0); + } + + // + public static void main(String[] args) { + System.out.println(); + } + +}