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.
71 lines
2.0 KiB
71 lines
2.0 KiB
package com.action;
|
|
|
|
import com.bean.electric_addBean;
|
|
import com.dao.electriDao;
|
|
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 electricupdate extends ActionSupport{
|
|
|
|
//下面是Action内用于封装用户请求参数的属性
|
|
private int Electric_ID;
|
|
|
|
private electric_addBean cnbean;
|
|
public int getElectric_ID() {
|
|
return Electric_ID;
|
|
}
|
|
|
|
public void setElectric_ID(int Electric_ID) {
|
|
this.Electric_ID= Electric_ID;
|
|
}
|
|
|
|
public electric_addBean getCnbean() {
|
|
return cnbean;
|
|
}
|
|
|
|
public void setCnbean(electric_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("<script language='javascript'>alert('请重新登录!');window.location='Login.jsp';</script>");
|
|
out.flush();out.close();return null;
|
|
}
|
|
|
|
//查询
|
|
cnbean=new electriDao().GetBean(Electric_ID);
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
//判断是否空值
|
|
private boolean isInvalid(String value) {
|
|
return (value == null || value.length() == 0);
|
|
}
|
|
|
|
//测试
|
|
public static void main(String[] args) {
|
|
System.out.println();
|
|
}
|
|
|
|
}
|
|
|
|
|