{$cfg_webname}
主页 > 计算机 > 论文 >

人力资源管理系统毕业论文设计范文(JSP)(9)

来源:56doc.com  资料编号:5D4541 资料等级:★★★★★ %E8%B5%84%E6%96%99%E7%BC%96%E5%8F%B7%EF%BC%9A5D4541
资料以网页介绍的为准,下载后不会有水印.资料仅供学习参考之用. 帮助
资料介绍

   return dao;
  } catch (InstantiationException e) {
   e.printStackTrace();
  } catch (IllegalAccessException e) {
   e.printStackTrace();
  }
  return null;
 }
}
Pagination类:
public class public class Pagination {
 private int rowCount;
 private int rowOfPage=15;
 private int curPage = 1;
 private int pageCount;

 public Pagination() {

 }
 public Pagination(int rowCount) {
  setRowCount(rowCount);
 }
 public Pagination(int rowCount, int rowOfPage) {
  setRowCount(rowCount);
  setRowOfPage(rowOfPage);
 }
 public void setRowCount(int rowCount){
  this.rowCount=rowCount;
  init();
 }
 
 public int getRowCount() {
  return rowCount;
 }
 public void setCurPage(int pageNum) {
  this.curPage = pageNum;
 }
 public void setRowOfPage(int rowOfPage) {
  this.rowOfPage = rowOfPage;
  init();
 }
 
 private void init(){
  pageCount=(int) java.lang.Math.ceil((double)rowCount / (double)rowOfPage);
 }
 public int getCurPage(){
  return curPage;
 }
 public int getPageCount(){
  return pageCount;
 }
 public int getFirst() {
  return 1;
 }

 public int getNext() {
  if (pageCount> curPage) {
   return curPage+1;
  } else {
   return pageCount;
  }
 }

 public int getPrevious() {
  if (curPage > 1){
   return curPage - 1;
  }
  return 1;
 }

 public int getLast() {
  return pageCount;
 }

 public int getStartRow() {
  return (this.curPage - 1) * this.rowOfPage;
 }

 public int getEndRow() {
  return curPage * this.rowOfPage;
 }
}
{
 private int rowCount;
 private int rowOfPage=15;
 private int curPage = 1;
 private int pageCount;

 public Pagination() {

 }
 public Pagination(int rowCount) {
  setRowCount(rowCount);
 }
 public Pagination(int rowCount, int rowOfPage) {
  setRowCount(rowCount);
  setRowOfPage(rowOfPage);
 }
 public void setRowCount(int rowCount){
  this.rowCount=rowCount;
  init();
 }
 
 public int getRowCount() {
  return rowCount;
 }
 public void setCurPage(int pageNum) {
  this.curPage = pageNum;
 }
 public void setRowOfPage(int rowOfPage) {
  this.rowOfPage = rowOfPage;
  init();
 }
 
 private void init(){
  pageCount=(int) java.lang.Math.ceil((double)rowCount / (double)rowOfPage);
 }
 public int getCurPage(){
  return curPage;
 }
 public int getPageCount(){
  return pageCount;
 }
 public int getFirst() {
  return 1;
 }

 public int getNext() {
  if (pageCount> curPage) {
   return curPage+1;
  } else {
   return pageCount;
  }
 }

 public int getPrevious() {
  if (curPage > 1){
   return curPage - 1;
  }
  return 1;
 }

 public int getLast() {
  return pageCount;
 }

 public int getStartRow() {
  return (this.curPage - 1) * this.rowOfPage;
 }

 public int getEndRow() {
  return curPage * this.rowOfPage;
 }
}
Controller层代码:
Action类:
public abstract class Action {
 protected final String SUCCESS="success";
 protected final String FAILURE="failure";
 protected ActionMessage message=new ActionMessage();
 protected Connection conn;
 protected abstract String execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException ;
 public String process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  request.setAttribute("message", message);
  return execute(request, response);
 }
 public void setConn(Connection conn){
  this.conn=conn;
 }
 protected abstract DTO initDTO(HttpServletRequest request);
 protected abstract boolean validate(DTO dto);
}
ActionConfig类:
public class ActionConfig {
 
 
 private static ActionConfig actionConfig;
 private Map<String,ActionInfo> actionInfos=new HashMap<String, ActionInfo>();
 private ActionConfig(URL url) throws JDOMException, IOException{
  SAXBuilder builder=new SAXBuilder();
  Document doc = builder.build(url);
  List<Element> list = XPath.selectNodes(doc,"//action-config/action");
  Iterator<Element> iter=list.iterator();

  while(iter.hasNext()){
   Element actionElt=iter.next();
   ActionInfo actionInfo=getActionInfo(actionElt);
   
   actionInfos.put(actionInfo.getPath(), actionInfo);
  }
  
  
 }
 private ActionInfo getActionInfo(Element actionElt) {
  ActionInfo action=new ActionInfo();
  action.setPath(actionElt.getAttributeValue("path"));
  action.setActionClass(actionElt.getAttributeValue("actionClass"));
  
  List<Element> list = actionElt.getChildren();
  Iterator<Element> iter=list.iterator();

  while(iter.hasNext()){
   Element forwardElt=iter.next();
   ActionForward forward=getForward(forwardElt);
   action.addActionForward(forward);
  }
  return action;
 }
 private ActionForward getForward(Element forwardElt) {
  ActionForward actionForward=new ActionForward();
  actionForward.setName(forwardElt.getAttributeValue("name"));
  actionForward.setPath(forwardElt.getAttributeValue("path"));
  actionForward.setRedirect(Boolean.parseBoolean(forwardElt.getAttributeValue("redirect")));
  return actionForward;
 }
 public static void init(URL url) throws JDOMException, IOException{
  if(actionConfig==null){
   actionConfig=new ActionConfig(url);
  }
 }
 public static ActionInfo getActionInfo(String path){
  if(actionConfig==null){
   System.out.println("没有初始化");

推荐资料