You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
143 lines
4.0 KiB
143 lines
4.0 KiB
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("<script language='javascript'>alert('请重新登录!');window.location='Login.jsp';</script>");
|
|
out.flush();out.close();return null;
|
|
}
|
|
|
|
//查询用户名是否存在
|
|
//List<Repair_addBean> list=new RepairDao().GetList("Teacher_Username='"+Teacher_Username+"' and Teacher_ID!="+Teacher_ID, "");
|
|
// if(list.size()>0)
|
|
// {
|
|
// out.print("<script language='javascript'>alert('用户名已经存在!');history.back(-1);</script>");
|
|
// 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("<script language='javascript'>alert('修改成功!');window.location='RepairManager.action';</script>");
|
|
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();
|
|
}
|
|
|
|
}
|