⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dispatchforward.java

📁 JSP+Struts+缓存的公司管理系统
💻 JAVA
字号:
//---------------------------------------------------------
// Application: Company Applcation
// Author     : Cao guangxin
// File       : DispatchForward.java
//
// Copyright 2006 RelationInfo Software
// Writed at Wed Apr 12 08:58:55 CST 2006
// writed by Eclipse SDK
// Visit http://www.37signals.cn
//---------------------------------------------------------

package net.cn37signals.company.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public  class DispatchForward extends Action {

  /**
   *  Forward request to "cancel", {forward}, or "error" mapping, where
   *  {forward} is an action path given in the parameter mapping or in the
   *  request as "forward=actionPath".
   *
   *@param  mapping   The ActionMapping used to select this instance
   *@param  request   The HTTP request we are processing
   *@param  response  The HTTP response we are creating
   *@param  form      Description of Parameter
   *@return           Description of the Returned Value
   */
  public ActionForward execute(ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {

    // -- isCancelled?
    if (isCancelled(request)) {
      form.reset(mapping, request);
      return (mapping.findForward("cancel"));
    }

    // -- Locals
    ActionForward thisForward = null;
    String wantForward = null;

    // -- Check internal parameter for forward
    wantForward = mapping.getParameter();

    // -- If not found, check request for forward
    if (wantForward == null) {
      wantForward = request.getParameter("forward");
    }

    // -- If found, consult mappings
    if (wantForward != null) {
      thisForward = mapping.findForward(wantForward);
    }

    // -- If anything not found, dispatch error
    if (thisForward == null) {
      thisForward = mapping.findForward("error");
      ActionErrors errors = new ActionErrors();
      errors.add(ActionErrors.GLOBAL_ERROR,
          new ActionError("action.missing.parameter"));
      saveErrors(request, errors);
    }

    return thisForward;
  }
  // end perform

}
// end Action

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -