亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? abstractaction.java

?? 基于java的組號查詢模塊
?? JAVA
字號:
package com.lily.dap.webapp.action;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

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

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.beanutils.converters.IntegerConverter;
import org.apache.commons.beanutils.converters.LongConverter;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.Globals;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.actions.DispatchAction;

import com.lily.dap.Constants;
import com.lily.dap.util.ConvertUtil;
import com.lily.dap.util.CurrencyConverter;
import com.lily.dap.util.DateConverter;

import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

/**
 * Implementation of <strong>Action</strong> that contains base methods for
 * Actions as well as determines with methods to call in subclasses. This class
 * uses the name of the button to determine which method to execute on the
 * Action.</p>
 *
 * <p>For example look at the following two buttons:</p>
 *
 *   <pre>
 *    &lt;html:submit property="method.findName"&gt;
 *       &lt;bean:message key="email.find"/&gt;
 *    &lt;/html:submit&gt;
 *
 *    &lt;html:submit property="method.findEmail"&gt;
 *       &lt;bean:message key="email.find"/&gt;
 *    &lt;/html:submit&gt;
 *   </pre>
 *
 * <p>The name of the button is set with the property parameter, i.e., the
 * name of the first button is method.findName. The name of the second button
 * is method.findEmail.</p>
 *
 * <p>As per HTML/HTTP, whatever submit button that is pushed causes only that
 * submit button's name to be sent as a request parameter to the action.</p>
 *
 * <p>This action looks for the name by removing the prepender string "method.".
 * The remaining part of the string is the name of the method to execute, e.g.,
 * pushing the first button will execute the findName method and the second
 * button will execute the findEmail method.</p>
 *
 * <p>This class extends DispatchAction and allows methods to be sent as
 * regular GETs as well, i.e., &lt;a href="emailAction.do?method=findEmail"/&gt;
 * would cause the findEmail method to be executed just as it would in a
 * DispatchAction. Thus, you configure a ButtonNameDispatchAction exactly
 * the way you configure a DispatchAction, i.e., set the mapping parameter
 * to the name of the request parameter that holds the mehtod name.</p>
 *
 * <p>
 * <a href="AbstractAction.java.html"><i>View Source</i></a>
 *
 * @author <a href="mailto:matt@raibledesigns.com">Matt Raible</a>
 * @author Rick Hightower (based on his ButtonNameDispatchAction)
 */
public class AbstractAction extends DispatchAction {
    protected final Log log = LogFactory.getLog(getClass());
    private static final Long defaultLong = null;

    static {
        ConvertUtils.register(new CurrencyConverter(), Double.class);
        ConvertUtils.register(new DateConverter(), Date.class);
        ConvertUtils.register(new DateConverter(), String.class);
        ConvertUtils.register(new LongConverter(defaultLong), Long.class);
        ConvertUtils.register(new IntegerConverter(defaultLong), Integer.class);
    }

    /**
     * Convenience method to get Spring-initialized beans
     *
     * @param name
     * @return Object bean from ApplicationContext
     */
    public Object getBean(String name) {
        ApplicationContext ctx = 
            WebApplicationContextUtils.getRequiredWebApplicationContext(servlet.getServletContext());
        return ctx.getBean(name);
    }

    /**
     * @see com.lily.dap.util.ConvertUtil#convert(java.lang.Object)
     */
    protected Object convert(Object o) throws Exception {
        return ConvertUtil.convert(o);
    }

    /**
     * @see com.lily.dap.util.ConvertUtil#convertLists(java.lang.Object)
     */
    protected Object convertLists(Object o) throws Exception {
        return ConvertUtil.convertLists(o);
    }

	/**
	 * 將FormBean中的內容通過BeanUtils的copyProperties()綁定到Object中.
	 * 因為BeanUtils中兩個參數(shù)的順序很容易搞錯,因此封裝此函數(shù)。
	 */
	protected void bindObject(ActionForm form, Object object) {
		try {
			BeanUtils.copyProperties(object, form);
		} catch (IllegalAccessException e) {
			log.error("Bind object from form error:" + e.getMessage());
		} catch (InvocationTargetException e) {
			log.error("Bind object from form error:" + e.getMessage());
		}
	}

	/**
	 * 將Object內容通過BeanUtils的copyProperties 復制到FormBean中。
	 * 因為BeanUtils中兩個參數(shù)的順序很容易搞錯,因此封裝此函數(shù)。
	 */
	protected void bindForm(ActionForm form, Object object) {
		try {
			BeanUtils.copyProperties(form, object);
		} catch (Exception e) {
			log.error("Set form from object error:" + e.getMessage());
		}
	}
	
    /**
     * Convenience method to initialize messages in a subclass.
     *
     * @param request the current request
     * @return the populated (or empty) messages
     */
    public ActionMessages getMessages(HttpServletRequest request) {
        ActionMessages messages = null;
        HttpSession session = request.getSession();

        if (request.getAttribute(Globals.MESSAGE_KEY) != null) {
            messages = (ActionMessages) request.getAttribute(Globals.MESSAGE_KEY);
            saveMessages(request, messages);
        } else if (session.getAttribute(Globals.MESSAGE_KEY) != null) {
            messages = (ActionMessages) session.getAttribute(Globals.MESSAGE_KEY);
            saveMessages(request, messages);
            session.removeAttribute(Globals.MESSAGE_KEY);
        } else {
            messages = new ActionMessages();
        }

        return messages;
    }

    /**
     * Gets the method name based on the mapping passed to it 
     */
    private String getActionMethodWithMapping(HttpServletRequest request, ActionMapping mapping) {
        return getActionMethod(request, mapping.getParameter());
    }

    /** 
     * Gets the method name based on the prepender passed to it.
     */
    protected String getActionMethod(HttpServletRequest request, String prepend) {
        String name = null;
        
        // for backwards compatibility, try with no prepend first
        name = request.getParameter(prepend);
        if (name != null) {
            // trim any whitespace around - this might happen on buttons
            name = name.trim();
            // lowercase first letter
            return name.replace(name.charAt(0), Character.toLowerCase(name.charAt(0)));
        }
        
        Enumeration e = request.getParameterNames();

        while (e.hasMoreElements()) {
            String currentName = (String) e.nextElement();

            if (currentName.startsWith(prepend + ".")) {
                if (log.isDebugEnabled()) {
                    log.debug("calling method: " + currentName);
                }

                String[] parameterMethodNameAndArgs = StringUtils.split(currentName, ".");
                name = parameterMethodNameAndArgs[1];
                break;
            }
        }
        
        return name;
    }

    /** 
     * Override the execute method in DispatchAction to parse
     * URLs and forward to methods without parameters.</p>
     * <p>
     * This is based on the following system:
     * <p/>
     * <ul>
     * <li>edit*.do -> edit method</li>
     * <li>save*.do -> save method</li>
     * <li>detail*.do -> search method</li>
     * </ul>
     */
    public ActionForward execute(ActionMapping mapping, ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response)
    throws Exception {
        
        if (isCancelled(request)) {
            try {
                getMethod("cancel");
                return dispatchMethod(mapping, form, request, response, "cancel");
            } catch (NoSuchMethodException n) {
                log.warn("No 'cancel' method found, returning null");
                return cancelled(mapping, form, request, response);
            }
        }

        // Check to see if methodName indicated by request parameter
        String actionMethod = getActionMethodWithMapping(request, mapping);
        
        if (actionMethod != null) {
            return dispatchMethod(mapping, form, request, response, actionMethod);
        } else {
            String[] rules = {"list", "add", "edit", "detail"};
            for (int i = 0; i < rules.length; i++) {
                // apply the rules for automatically appending the method name
                if (request.getServletPath().indexOf(rules[i]) > -1) {
                    return dispatchMethod(mapping, form, request, response, rules[i]);
                }
            }
        }
        
        return super.execute(mapping, form, request, response);
    }

    /**
     * Convenience method for getting an action form base on it's mapped scope.
     *
     * @param mapping The ActionMapping used to select this instance
     * @param request The HTTP request we are processing
     * @return ActionForm the form from the specifies scope, or null if nothing
     *         found
     */
    protected ActionForm getActionForm(ActionMapping mapping, HttpServletRequest request) {
        ActionForm actionForm = null;

        // Remove the obsolete form bean
        if (mapping.getAttribute() != null) {
            if ("request".equals(mapping.getScope())) {
                actionForm = (ActionForm) request.getAttribute(mapping.getAttribute());
            } else {
                HttpSession session = request.getSession();
                actionForm = (ActionForm) session.getAttribute(mapping.getAttribute());
            }
        }

        return actionForm;
    }

    /**
     * Convenience method to get the Configuration HashMap
     * from the servlet context.
     *
     * @return the user's populated form from the session
     */
    public Map getConfiguration() {
        Map config = (HashMap) getServlet().getServletContext().getAttribute(Constants.CONFIG);

        // so unit tests don't puke when nothing's been set
        if (config == null) {
            return new HashMap();
        }

        return config;
    }

    /**
     * Convenience method for removing the obsolete form bean.
     *
     * @param mapping The ActionMapping used to select this instance
     * @param request The HTTP request we are processing
     */
    protected void removeFormBean(ActionMapping mapping, HttpServletRequest request) {
        // Remove the obsolete form bean
        if (mapping.getAttribute() != null) {
            if ("request".equals(mapping.getScope())) {
                request.removeAttribute(mapping.getAttribute());
            } else {
                HttpSession session = request.getSession();
                session.removeAttribute(mapping.getAttribute());
            }
        }
    }

    /**
     * Convenience method to update a formBean in it's scope
     *
     * @param mapping The ActionMapping used to select this instance
     * @param request The HTTP request we are processing
     * @param form    The ActionForm
     */
    protected void updateFormBean(ActionMapping mapping, HttpServletRequest request, ActionForm form) {
        // Remove the obsolete form bean
        if (mapping.getAttribute() != null) {
            if ("request".equals(mapping.getScope())) {
                request.setAttribute(mapping.getAttribute(), form);
            } else {
                HttpSession session = request.getSession();
                session.setAttribute(mapping.getAttribute(), form);
            }
        }
    }
    
    /**
     * 搜索Forward,并加上系統(tǒng)指定的參數(shù)
     * 
     * @param mapping
     * @param name
     * @param paramName
     * @param paramVal
     * @param redirect
     * @return
     */
    protected ActionForward findForward(ActionMapping mapping, String name, String paramName, long paramVal, boolean redirect) {
    	return findForward(mapping, name, new String[]{paramName}, new String[]{String.valueOf(paramVal)}, redirect);
    }
    
    /**
     * 搜索Forward,并加上系統(tǒng)指定的參數(shù)
     * 
     * @param mapping
     * @param name
     * @param paramName
     * @param paramVal
     * @param redirect
     * @return
     */
    protected ActionForward findForward(ActionMapping mapping, String name, String paramName, String paramVal, boolean redirect) {
    	return findForward(mapping, name, new String[]{paramName}, new String[]{paramVal}, redirect);
    }
    
    /**
     * 搜索Forward,并加上系統(tǒng)指定的參數(shù)
     * 
     * @param mapping
     * @param name
     * @param paramNames
     * @param paramVals
     * @param bl
     * @return
     */
    protected ActionForward findForward(ActionMapping mapping, String name, String[] paramNames, String[] paramVals, boolean redirect) {
        ActionForward actForward = mapping.findForward(name);
        String path = actForward.getPath();
        
        if (paramNames != null && paramNames.length > 0) {
            String c = path.indexOf('?') < 0 ? "?" : "&";
            path += c + paramNames[0] + "=" + paramVals[0];
            
            for (int i = 1; i < paramNames.length; i++)
                path += "&" + paramNames[i] + "=" + paramVals[i];
        }
        
        return new ActionForward(actForward.getName(), path, redirect);
    }
    
	/**
	 * 直接輸出純字符串
	 */
	public void renderText(HttpServletResponse response, String text) {
		try {
			response.setContentType("text/plain;charset=UTF-8");
			response.getWriter().write(text);
		} catch (IOException e) {
			log.error(e.getMessage(), e);
		}
	}

	/**
	 * 直接輸出純HTML
	 */
	public void renderHtml(HttpServletResponse response, String text) {
		try {
			response.setContentType("text/html;charset=UTF-8");
			response.getWriter().write(text);
		} catch (IOException e) {
			log.error(e.getMessage(), e);
		}
	}

	/**
	 * 直接輸出純XML
	 */
	public void renderXML(HttpServletResponse response, String text) {
		try {
			response.setContentType("text/xml;charset=UTF-8");
			response.getWriter().write(text);
		} catch (IOException e) {
			log.error(e.getMessage(), e);
		}
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人短视频下载 | 一区二区三区精品视频| 亚洲成人在线免费| 国产 日韩 欧美大片| 精品视频一区三区九区| 国产精品久久久久久久久晋中 | 色婷婷精品大视频在线蜜桃视频| 在线成人免费视频| 18涩涩午夜精品.www| 精品午夜一区二区三区在线观看 | 国产东北露脸精品视频| 欧美男人的天堂一二区| 亚洲欧美国产三级| 粗大黑人巨茎大战欧美成人| 欧美电视剧免费观看| 日日夜夜精品视频免费| 色综合久久久久网| 亚洲欧洲国产日韩| 高清不卡在线观看| 国产亚洲精品aa| 另类小说欧美激情| 日韩一区二区影院| 日韩精品一二三区| 欧美精品在线一区二区| 午夜av区久久| 欧美视频中文字幕| 亚洲成人激情av| 欧美四级电影在线观看| 亚洲妇熟xx妇色黄| 欧美日韩一区二区不卡| 亚洲妇女屁股眼交7| 欧美熟乱第一页| 视频一区在线视频| 欧美一区二区三区视频| 视频一区二区三区中文字幕| 欧美三级视频在线| 婷婷开心激情综合| 这里是久久伊人| 极品少妇一区二区三区精品视频| 欧美mv和日韩mv的网站| 国产一区二区三区日韩| 国产亚洲欧美激情| 色综合色狠狠综合色| 亚洲精品国久久99热| 欧美日韩一区视频| 日本一区中文字幕 | 精品一区二区三区在线播放视频| 日韩欧美激情一区| 国产经典欧美精品| 日韩码欧中文字| 欧美三级韩国三级日本一级| 日韩av一二三| 国产人成一区二区三区影院| voyeur盗摄精品| 午夜视频一区二区| 久久伊99综合婷婷久久伊| 成人午夜大片免费观看| 亚洲综合av网| 久久综合九色欧美综合狠狠| 9色porny自拍视频一区二区| 亚洲国产乱码最新视频| 久久久国产精华| 在线亚洲人成电影网站色www| 婷婷六月综合网| 中文字幕 久热精品 视频在线| 色中色一区二区| 久久99热狠狠色一区二区| 国产精品视频第一区| 欧美在线三级电影| 国产成人免费在线视频| 亚洲精品成人精品456| 精品成a人在线观看| 在线看日本不卡| 国产99久久久国产精品潘金| 亚洲成人动漫在线观看| 久久久国产综合精品女国产盗摄| 91国偷自产一区二区三区观看| 国产资源精品在线观看| 亚洲一区二区三区精品在线| 久久久久久久综合| 欧美一三区三区四区免费在线看| 97久久超碰国产精品| 蜜乳av一区二区三区| 亚洲欧美电影院| 亚洲国产精品国自产拍av| 91精品久久久久久久91蜜桃| 色婷婷亚洲综合| 国产成人亚洲精品青草天美 | 亚洲一区二区三区自拍| 亚洲国产精品成人久久综合一区 | 国产女人aaa级久久久级| 91精品视频网| 欧美艳星brazzers| 91首页免费视频| 国产电影一区在线| 国产一区在线视频| 麻豆国产91在线播放| 亚洲高清不卡在线观看| 亚洲精品免费电影| 亚洲欧洲性图库| 日本一区二区综合亚洲| 国产日韩高清在线| 亚洲精品一区二区三区四区高清| 3751色影院一区二区三区| 欧美三级视频在线观看| 在线区一区二视频| 欧美中文字幕一二三区视频| 色哟哟亚洲精品| 一本久道久久综合中文字幕 | 日本成人在线不卡视频| 午夜精品久久久久久久久久久| 一区二区三区小说| 一区二区三区 在线观看视频| 亚洲精品视频在线观看网站| 亚洲日本va午夜在线电影| 亚洲欧洲日产国码二区| 亚洲欧美国产高清| 亚洲成a天堂v人片| 天堂蜜桃91精品| 日本中文字幕一区二区有限公司| 蜜臀av性久久久久蜜臀aⅴ流畅| 美女高潮久久久| 国产一区二区三区在线观看精品 | 亚洲成av人综合在线观看| 亚洲第一福利一区| 日韩福利视频导航| 黄页网站大全一区二区| 国产福利精品导航| 99精品1区2区| 欧美在线一二三四区| 欧美伦理影视网| 日韩视频在线永久播放| 久久久久久**毛片大全| 中文字幕第一页久久| 亚洲精品国久久99热| 日本亚洲天堂网| 国产精品中文字幕日韩精品 | 国产精品一区二区在线看| 成人晚上爱看视频| 色88888久久久久久影院按摩| 欧美日韩国产成人在线91| 欧美xxxx在线观看| 亚洲色图都市小说| 丝袜脚交一区二区| 豆国产96在线|亚洲| 色狠狠色噜噜噜综合网| 欧美一区二区高清| 欧美激情综合在线| 婷婷成人激情在线网| 国产一区二区三区在线观看免费视频| 99久久伊人久久99| 在线成人av影院| 国产精品入口麻豆九色| 亚洲第一福利一区| 国产剧情一区在线| 欧美视频在线观看一区| 国产欧美日韩久久| 天天影视涩香欲综合网| 粉嫩高潮美女一区二区三区| 欧美日韩精品久久久| 国产欧美精品一区二区色综合| 亚洲一区在线视频| 国产不卡在线视频| 91精品在线一区二区| 亚洲天堂免费在线观看视频| 狠狠色狠狠色合久久伊人| 欧美在线视频全部完| 国产精品免费丝袜| 麻豆久久久久久| 欧美日韩aaa| 亚洲柠檬福利资源导航| 国产精品888| 精品久久久久一区| 日韩—二三区免费观看av| 色菇凉天天综合网| 国产精品灌醉下药二区| 国模娜娜一区二区三区| 欧美一级一区二区| 污片在线观看一区二区| 日本乱人伦aⅴ精品| 国产精品私房写真福利视频| 久久97超碰色| 日韩一区二区不卡| 婷婷丁香久久五月婷婷| 在线看国产一区二区| 亚洲精品国产一区二区精华液 | 欧美精品一区二区三区在线播放| 亚洲成av人影院| 欧美性猛交xxxxxx富婆| 一区二区三区不卡在线观看 | 国产精品伦一区| 韩国一区二区视频| 精品国偷自产国产一区| 久久精品国产亚洲一区二区三区| 欧美一区二区在线视频| 日本成人在线视频网站| 日韩视频一区二区在线观看| 日韩电影免费在线看| 欧美一区二区视频在线观看2022| 日本伊人精品一区二区三区观看方式|