Open Nav

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

以下是资料介绍,如需要完整的请充值下载.
1.无需注册登录,支付后按照提示操作即可获取该资料.
2.资料以网页介绍的为准,下载后不会有水印.仅供学习参考之用.
   帮助中心
资料介绍:

  }
  return actionConfig.actionInfos.get(path);
 }
}
ActionServlet类:
public class ActionServlet extends HttpServlet {
[资料来源:https://www.doc163.com]

 public void init() throws ServletException {
  // 根据参数去解析xml
  try {
   // 初始化action
   String config = this.getInitParameter("action-config");
   URL url = getServletContext().getResource(config);
   ActionConfig.init(url);
   // 初始化DataSource
   config = this.getInitParameter("db-config");
   url = getServletContext().getResource(config);
   DbConfig.init(url);
   // 初始化系统配置SysConfig
   config = this.getInitParameter("sys-config");
   url = getServletContext().getResource(config);
   SysConfig.init(url); [资料来源:http://www.doc163.com]

  } catch (MalformedURLException e) {
   e.printStackTrace();
  } catch (JDOMException e) {
   e.printStackTrace();
  } catch (IOException e) {
   e.printStackTrace();
  }

[资料来源:www.doc163.com]

 } [资料来源:https://www.doc163.com]

 public void doGet(HttpServletRequest request, HttpServletResponse response)
   throws IOException, ServletException {
  process(request, response);
 }

[资料来源:http://www.doc163.com]

 public void doPost(HttpServletRequest request, HttpServletResponse response)
   throws IOException, ServletException {
  process(request, response);
 }

[资料来源:http://doc163.com]

 protected void process(HttpServletRequest request,
   HttpServletResponse response) throws IOException, ServletException {
  String path = parseURI(request);
  ActionInfo actionInfo = ActionConfig.getActionInfo(path);
  try {
   if (actionInfo == null) {
    throw new ActionException("不能找到“" + path + "”的Action映射关系");
   }
   Action action = ActionFactory.createAction(actionInfo);
   // 为Action创建数据连接对象Connection,以提供处理请求时使用,请求处理完毕,关才连接
   Connection conn=null;
   String forward = null;
   try {
    conn = ConnFactory.getConn(SysConfig.getDbName());
    action.setConn(conn);
    forward = action.process(request, response);

[资料来源:Doc163.com]

   } catch (Exception e) {
    throw e;
   } finally {
    conn.close();
   }
   ActionForward actionForward = actionInfo.findActionForward(forward);
   if (actionForward == null) {
    throw new ActionException("在action:“" + path + "”中不能找到“"
      + forward + "”的映射关系");
   }
   if (actionForward.getRedirect()) {
    response.sendRedirect(actionForward.getPath());
   } else {
    request.getRequestDispatcher(actionForward.getPath()).forward(
      request, response);
   } [来源:http://www.doc163.com]

  } catch (ActionException e) {
   e.printStackTrace();
  } catch (Exception e) {
   request.getRequestDispatcher("error.jsp")
     .forward(request, response);
   e.printStackTrace();
  }
 }
 private String parseURI(HttpServletRequest request) {
  String path = request.getRequestURI();
  String contextPath = request.getContextPath();
  if (path.startsWith(contextPath)) {
   path = path.substring(contextPath.length());
  }
  int end = path.lastIndexOf(".");
  path = path.substring(0, end);
  return path;
 }
 public void destroy() {
 }
}

[资料来源:http://Doc163.com]

  [资料来源:https://www.doc163.com]

  • 关于资料
    提供的资料属本站所有,真实可靠,确保下载的内容与网页资料介绍一致.
  • 如何下载
    提供下载链接或发送至您的邮箱,资料可重复发送,若未收到请联系客服.
  • 疑难帮助
    下载后提供一定的帮助,收到资料后若有疑难问题,可联系客服提供帮助.
  • 关于服务
    确保下载的资料和介绍一致,如核实与资料介绍不符,可申请售后.
  • 资料仅供参考和学习交流之用,请勿做其他非法用途,转载必究,如有侵犯您的权利或有损您的利益,请联系本站,经查实我们会立即进行修正! 版权所有,严禁转载
    doc163.com Copyright © 2012-2024 苏ICP备2021029856号-4