forwarddispatchaction.java
来自「一个实用工具类」· Java 代码 · 共 62 行
JAVA
62 行
/* * Copyright (C) butor.com. All rights reserved. * * This software is published under the terms of the GNU Library General * Public License (GNU LGPL), a copy of which has been included with this * distribution in the LICENSE.txt file. */package org.butor.web.helper;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.butor.log.Log;/** * <p>Takes the value of action mapping's parameter attribute and * use it to forward the request. This is especially handy when * using a generic tile. * </p> * example: * <pre> * <action path="/search/tile" * type="org.butor.wak.web.helper.ForwardDispatchAction" * scope="request" * validate="false" * parameter="search_mode"> * <forward name="MODE_CLT" path="search.client"/> * <forward name="MODE_REP" path="search.rep"/> * <forward name="MODE_SUCC" path="search.branch"/> * <forward name="MODE_FRM" path="search.firm"/> * </action> * </pre> * * @author mateusfi */public class ForwardDispatchAction extends Action { public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String parameter = mapping.getParameter(); String value = request.getParameter(parameter); if (value != null) { return mapping.findForward(value); } Log.logStr(this, Log.LOG_TYPE_ERROR, "execute", "Did not find '" + value + "' forward entry"); return null; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?