EditPeopleAction.java
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package action;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.web.struts.ActionSupport;
import service.StudentManagerImpl;
import domain.People;
/**
* MyEclipse Struts
* Creation date: 01-17-2007
*
* XDoclet definition:
* @struts.action validate="true"
*/
public class EditPeopleAction extends ActionSupport {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String id=request.getParameter("id");
StudentManagerImpl manager=(StudentManagerImpl)getWebApplicationContext().getBean("studentManager");
People people=(People)manager.getPeople(new Integer(id));
request.setAttribute("id", id);
request.setAttribute("name", people.getName());
request.setAttribute("location", people.getLocation());
return mapping.findForward("success");
}
}
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package action;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.web.struts.ActionSupport;
import service.StudentManagerImpl;
import domain.People;
/**
* MyEclipse Struts
* Creation date: 01-17-2007
*
* XDoclet definition:
* @struts.action validate="true"
*/
public class EditPeopleAction extends ActionSupport {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String id=request.getParameter("id");
StudentManagerImpl manager=(StudentManagerImpl)getWebApplicationContext().getBean("studentManager");
People people=(People)manager.getPeople(new Integer(id));
request.setAttribute("id", id);
request.setAttribute("name", people.getName());
request.setAttribute("location", people.getLocation());
return mapping.findForward("success");
}
}
EditPeopleActionDo.java
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package action;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.web.struts.ActionSupport;
import service.StudentManagerImpl;
import domain.People;
/**
* MyEclipse Struts
* Creation date: 01-17-2007
*
* XDoclet definition:
* @struts.action validate="true"
*/
public class EditPeopleActionDo extends ActionSupport {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
People people=(People)form;
StudentManagerImpl manager=(StudentManagerImpl)getWebApplicationContext().getBean("studentManager");
People sPeople=(People)manager.getPeople(new Integer(people.getId()));
sPeople.setName(people.getName());
sPeople.setLocation(people.getLocation());
manager.editPeople(sPeople);
List studentList=manager.listPeople(0,5,"from People");
request.setAttribute("studentList", studentList);
request.setAttribute("currentPage", 1);
return mapping.findForward("success");
}
}
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package action;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.web.struts.ActionSupport;
import service.StudentManagerImpl;
import domain.People;
/**
* MyEclipse Struts
* Creation date: 01-17-2007
*
* XDoclet definition:
* @struts.action validate="true"
*/
public class EditPeopleActionDo extends ActionSupport {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
People people=(People)form;
StudentManagerImpl manager=(StudentManagerImpl)getWebApplicationContext().getBean("studentManager");
People sPeople=(People)manager.getPeople(new Integer(people.getId()));
sPeople.setName(people.getName());
sPeople.setLocation(people.getLocation());
manager.editPeople(sPeople);
List studentList=manager.listPeople(0,5,"from People");
request.setAttribute("studentList", studentList);
request.setAttribute("currentPage", 1);
return mapping.findForward("success");
}
}
ListPeopleAction.java
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.web.struts.ActionSupport;
import service.StudentManagerImpl;
import util.PageSupport;
/**
* MyEclipse Struts
* Creation date: 01-17-2007
*
* XDoclet definition:
* @struts.action validate="true"
*/
public class ListPeopleAction extends ActionSupport {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String page=request.getParameter("page");
int firstRow=0;
int lastRow=0;
StudentManagerImpl manager=(StudentManagerImpl)getWebApplicationContext().getBean("studentManager");
PageSupport sPage=new PageSupport(page);
sPage.setPagetotal(manager.listPeople().size());
firstRow=sPage.calcFirstPage();
lastRow=sPage.calcLastPage();
List studentList=manager.listPeople(firstRow-1,lastRow,"from People");
request.setAttribute("studentList", studentList);
request.setAttribute("currentPage", sPage.getThispage());
return mapping.findForward("success");
}
}
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.web.struts.ActionSupport;
import service.StudentManagerImpl;
import util.PageSupport;
/**
* MyEclipse Struts
* Creation date: 01-17-2007
*
* XDoclet definition:
* @struts.action validate="true"
*/
public class ListPeopleAction extends ActionSupport {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String page=request.getParameter("page");
int firstRow=0;
int lastRow=0;
StudentManagerImpl manager=(StudentManagerImpl)getWebApplicationContext().getBean("studentManager");
PageSupport sPage=new PageSupport(page);
sPage.setPagetotal(manager.listPeople().size());
firstRow=sPage.calcFirstPage();
lastRow=sPage.calcLastPage();
List studentList=manager.listPeople(firstRow-1,lastRow,"from People");
request.setAttribute("studentList", studentList);
request.setAttribute("currentPage", sPage.getThispage());
return mapping.findForward("success");
}
}
SavePeopleAction.java
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package action;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.web.struts.ActionSupport;
import service.StudentManagerImpl;
import domain.People;
/**
* MyEclipse Struts
* Creation date: 01-17-2007
*
* XDoclet definition:
* @struts.action validate="true"
*/
public class SavePeopleAction extends ActionSupport {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
People people=(People)form;
StudentManagerImpl manager=(StudentManagerImpl)getWebApplicationContext().getBean("studentManager");
manager.savePeople(people);
return mapping.findForward("success");
}
}
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package action;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.web.struts.ActionSupport;
import service.StudentManagerImpl;
import domain.People;
/**
* MyEclipse Struts
* Creation date: 01-17-2007
*
* XDoclet definition:
* @struts.action validate="true"
*/
public class SavePeopleAction extends ActionSupport {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
People people=(People)form;
StudentManagerImpl manager=(StudentManagerImpl)getWebApplicationContext().getBean("studentManager");
manager.savePeople(people);
return mapping.findForward("success");
}
}