content: package com.andy.action;
  
  import java.io.IOException;
  import java.io.PrintWriter;
  import java.io.UnsupportedEncodingException;
  
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import org.apache.struts2.ServletActionContext;
  
  import com.andy.service.StudentService;
  import com.andy.service.StudentServiceImpl;
  import com.opensymphony.xwork2.ActionSupport;
  
  public class StudentDeleteAction extends ActionSupport{
  	private StudentService studentService = new StudentServiceImpl();
  	private String cid;
  
  	public String getCid() {
  		return cid;
  	}
  
  	public void setCid(String cid) {
  		this.cid = cid;
  	}
  	public void delete() throws IOException{
  		HttpServletRequest request = ServletActionContext.getRequest();
  		HttpServletResponse response = ServletActionContext.getResponse();
  		request.setCharacterEncoding("utf-8");
  		response.setCharacterEncoding("utf-8");
  		PrintWriter out = response.getWriter();
  		if(studentService.deleteStudent(cid)){
  			out.print("deleteok");
  		}else{
  			out.print("deletefail");
  		}
  	}
  }
  