/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.yourcompany.struts.action;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import po.Po;
import com.yourcompany.struts.form.BForm;
import dao.Dao;
public class BAction extends DispatchAction {
private Dao d;
public Dao getD() {
return d;
}
public void setD(Dao d) {
this.d = d;
}
public ActionForward Update(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
BForm tForm = (BForm) form;
// execute
Po p = new Po();
p.setAccount(tForm.getOaccount());
p.setPassword(tForm.getOaccount());
List rs = this.d.Query(p);
Iterator it = rs.iterator();
while (it.hasNext()) {
p = (Po) it.next();
System.out.print(p.getId() + "id");
p = this.d.read(p.getId());
p.setAccount(tForm.getAccount());
p.setPassword(tForm.getPassword());
String abc = this.d.update(p);
if (abc.equals("abc")) {
return mapping.findForward("S");
} else {
return mapping.findForward("E");
}
}
return mapping.findForward("");
}
public ActionForward Del(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
BForm tForm = (BForm) form;
Po p = new Po();
p.setAccount(tForm.getOaccount());
p.setPassword(tForm.getOaccount());
List rs = this.d.Query(p);
Iterator it = rs.iterator();
while (it.hasNext()) {
p = (Po) it.next();
System.out.print(p.getId() + "id");
p = this.d.read(p.getId());
p.setId(p.getId());
String abc = this.d.Del(p);
if (abc.equals("abc")) {
return mapping.findForward("S");
} else {
return mapping.findForward("E");
}
}
return mapping.findForward("");
}
public ActionForward Regedit(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
BForm tForm = (BForm) form;
Po p = new Po();
p.setAccount(tForm.getAccount());
p.setPassword(tForm.getPassword());
String abc = this.d.Regedit(p);
if (abc.equals("abc")) {
return mapping.findForward("S");
} else {
return mapping.findForward("E");
}
}
public void getDao() {
WebApplicationContext wac =
WebApplicationContextUtils.getRequiredWebApplicationContext(this
.getServlet().getServletContext());
d = (Dao) wac.getBean("d");
}
}
ADU.rar_spring_ssh_ssh access_ssh java_增 删 改
版权申诉
132 浏览量
2022-09-21
04:14:49
上传
评论
收藏 2.73MB RAR 举报
寒泊
- 粉丝: 75
- 资源: 1万+