|
|
|
|
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 {
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Action<6F><6E><EFBFBD><EFBFBD><EFBFBD>ڷ<EFBFBD>װ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>execute<74><65><EFBFBD><EFBFBD>
|
|
|
|
|
public String execute() throws Exception {
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룬<EFBFBD><EBA3AC><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
HttpServletResponse response=null;
|
|
|
|
|
response=ServletActionContext.getResponse();
|
|
|
|
|
response.setContentType("text/html;charset=UTF-8");
|
|
|
|
|
response.setCharacterEncoding("UTF-8");
|
|
|
|
|
PrintWriter out = response.getWriter();
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>session<6F><6E><EFBFBD><EFBFBD>
|
|
|
|
|
HttpSession session = ServletActionContext.getRequest().getSession();
|
|
|
|
|
//<2F><>֤<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
|
|
|
|
if(session.getAttribute("id")==null){
|
|
|
|
|
out.print("<script language='javascript'>alert('<27><><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>¼<EFBFBD><C2BC>');window.location='Login.jsp';</script>");
|
|
|
|
|
out.flush();out.close();return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>ѯ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
List<StudentBean> list=new StudentDao().GetList("Student_Username='"+Student_Username+"'", "");
|
|
|
|
|
if(list.size()>0)
|
|
|
|
|
{
|
|
|
|
|
out.print("<script language='javascript'>alert('<27>û<EFBFBD><C3BB><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ڣ<EFBFBD>');history.back(-1);</script>");
|
|
|
|
|
out.flush();out.close();return null;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
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("δ<><CEB4>ס");
|
|
|
|
|
cnbean.setStudent_DomitoryID(1);
|
|
|
|
|
new StudentDao().Add(cnbean);
|
|
|
|
|
|
|
|
|
|
//<2F><>ת
|
|
|
|
|
out.print("<script language='javascript'>alert('<27><><EFBFBD>ӳɹ<D3B3><C9B9><EFBFBD>');window.location='StudentManager.action';</script>");
|
|
|
|
|
out.flush();out.close();return null;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD>ֵ
|
|
|
|
|
private boolean isInvalid(String value) {
|
|
|
|
|
return (value == null || value.length() == 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
System.out.println();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|