<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Java技術專區--Hilly

    http://blog.duyouyou.com
       :: 首頁 :: 新隨筆 :: 聯系 ::  :: 管理

    官方Class LookupDispatchAction說明文檔(轉)

    Posted on 2006-07-20 18:18 duyouyou.com 閱讀(485) 評論(0)  編輯  收藏 所屬分類: web技術

    org.apache.struts.actions

    Class LookupDispatchAction



    java.lang.Object extended byorg.apache.struts.action.Actionextended byorg.apache.struts.actions.DispatchActionextended byorg.apache.struts.actions.LookupDispatchAction

    public abstract class LookupDispatchAction
    extends DispatchAction


    An abstract Action that dispatches to the subclass mapped execute method. This is useful in cases where an HTML form has multiple submit buttons with the same name. The button name is specified by the parameter property of the corresponding ActionMapping. To configure the use of this action in your struts-config.xml file, create an entry like this:

       <action path="/test"
    ??????type="org.example.MyAction"
    ??????name="MyForm"
    ??????scope="request"
    ??????input="/test.jsp"
    ??????parameter="method"/>

    which will use the value of the request parameter named "method" to locate the corresponding key in ApplicationResources. For example, you might have the following ApplicationResources.properties:

        button.add=Add Record    button.delete=Delete Record  

    And your JSP would have the following format for submit buttons:

       <html:form action="/test">
    ???<html:submit property="method">
    ??? <bean:message key="button.add"/>
    </html:submit>
    <html:submit property="method">
    ???<bean:message key="button.delete"/>
    </html:submit> </html:form>

    Your subclass must implement both getKeyMethodMap and the methods defined in the map. An example of such implementations are:

      protected Map getKeyMethodMap() {
    Map map = new HashMap();
    map.put("button.add", "add");
    map.put("button.delete", "delete");
    return map;
    }
    public ActionForward add(ActionMapping mapping,
    ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws IOException, ServletException {
    // do add
    return mapping.findForward("success");
    }
    public ActionForward delete(ActionMapping mapping,
    ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws IOException, ServletException {
    // do delete
    return mapping.findForward("success");
    }

    Notes - If duplicate values exist for the keys returned by getKeys,
    only the first one found will be returned. If no corresponding key is found
    then an exception will be thrown. You can override the method unspecified to
    provide a custom handler. If the submit was cancelled (a html:cancel button
    was pressed), the custom handler cancelled will be used instead.


    Field Summary
    protected ?java.util.MapkeyMethodMap
    ??????????Resource key to method name lookup.
    protected ?java.util.MaplocaleMap
    ??????????Reverse lookup map from resource value to resource key.
    ?
    Fields inherited from class org.apache.struts.actions.DispatchAction
    clazz, log, messages, methods, types
    ?
    Fields inherited from class org.apache.struts.action.Action
    defaultLocale, servlet
    ?
    Constructor Summary
    LookupDispatchAction()
    ???????????
    ?
    Method Summary
    ?ActionForwardexecute(ActionMapping?mapping, ActionForm?form, javax.servlet.http.HttpServletRequest?request, javax.servlet.http.HttpServletResponse?response)
    ??????????Process the specified HTTP request, and create the corresponding HTTP response (or forward to another web component that will create it).
    protected abstract ?java.util.MapgetKeyMethodMap()
    ??????????Provides the mapping from resource key to method name.
    protected ?java.lang.StringgetLookupMapName(javax.servlet.http.HttpServletRequest?request, java.lang.String?keyName, ActionMapping?mapping)
    ??????????Lookup the method name corresponding to the client request's locale.
    protected ?java.lang.StringgetMethodName(ActionMapping?mapping, ActionForm?form, javax.servlet.http.HttpServletRequest?request, javax.servlet.http.HttpServletResponse?response, java.lang.String?parameter)
    ??????????Returns the method name, given a parameter's value.
    private ?java.util.MapinitLookupMap(javax.servlet.http.HttpServletRequest?request, java.util.Locale?userLocale)
    ??????????This is the first time this Locale is used so build the reverse lookup Map.
    ?
    Methods inherited from class org.apache.struts.actions.DispatchAction
    cancelled, dispatchMethod, getMethod, unspecified
    ?
    Methods inherited from class org.apache.struts.action.Action
    addErrors, addMessages, execute, generateToken, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
    ?
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    ?

    Field Detail

    localeMap

    protected java.util.Map localeMap
    Reverse lookup map from resource value to resource key.


    keyMethodMap

    protected java.util.Map keyMethodMap
    Resource key to method name lookup.

    Constructor Detail

    LookupDispatchAction

    public LookupDispatchAction()
    Method Detail

    execute

    public ActionForwardexecute(ActionMapping?mapping,
    ActionForm?form,
    javax.servlet.http.HttpServletRequest?request,
    javax.servlet.http.HttpServletResponse?response)
    throws java.lang.Exception
    Process the specified HTTP request, and create the corresponding HTTP
    response (or forward to another web component that will create it).
    Return an ActionForward instance describing where and how control should
    be forwarded, or null if the response has already been completed.

    Overrides:
    execute in class DispatchAction
    Parameters:
    mapping - The ActionMapping used to select this instance
    request - The HTTP request we are processing
    response - The HTTP response we are creating
    form - The optional ActionForm bean for this request (if any)
    Returns:
    Describes where and how control should be forwarded.
    Throws:
    java.lang.Exception - if an error occurs

    initLookupMap

    private java.util.Map initLookupMap(
    ?????????????????????????????????javax.servlet.http.HttpServletRequest?request,
    java.util.Locale?userLocale)
    This is the first time this Locale is used so build the reverse lookup Map.
    Search for message keys in all configured MessageResources for the current
    module.


    getKeyMethodMap

    protected abstract java.util.Map getKeyMethodMap()
    Provides the mapping from resource key to method name.

    Returns:
    Resource key / method name map.

    getLookupMapName

    protected java.lang.String getLookupMapName(
    ????????????????????????javax.servlet.http.HttpServletRequest?request,
    java.lang.String?keyName,
    ActionMapping?mapping)
    throws javax.servlet.ServletException
    Lookup the method name corresponding to the client request's locale.

    Parameters:
    request - The HTTP request we are processing
    keyName - The parameter name to use as the properties key
    mapping - The ActionMapping used to select this instance
    Returns:
    The method's localized name.
    Throws:
    javax.servlet.ServletException - if keyName cannot be resolved
    Since:
    Struts 1.2.0

    getMethodName

    protected java.lang.String getMethodName(ActionMapping?mapping,
    ActionForm?form,
    javax.servlet.http.HttpServletRequest?request,
    javax.servlet.http.HttpServletResponse?response,
    java.lang.String?parameter)
    throws java.lang.Exception
    Returns the method name, given a parameter's value.

    Overrides:
    getMethodName in class DispatchAction
    Parameters:
    mapping - The ActionMapping used to select this instance
    form - The optional ActionForm bean for this request (if any)
    request - The HTTP request we are processing
    response - The HTTP response we are creating
    parameter - The ActionMapping parameter's name
    Returns:
    The method's name.
    Throws:
    java.lang.Exception
    Since:
    Struts 1.2.0


    Copyright ? 2000-2004 - The Apache Software Foundation


    Hold住
    主站蜘蛛池模板: 亚洲色欲久久久综合网| 亚洲伊人久久大香线蕉啊| 少妇无码一区二区三区免费| 亚洲欧洲日产专区| 国产三级免费电影| 亚在线观看免费视频入口| 亚洲色大成网站www久久九| 国产亚洲精品影视在线产品| 日本免费xxxx色视频| 日日摸日日碰夜夜爽亚洲| 亚洲精品综合一二三区在线| 日韩免费一级毛片| 91香蕉在线观看免费高清| 黄页网站在线视频免费| 亚洲神级电影国语版| 亚洲国产午夜福利在线播放| 18禁黄网站禁片免费观看不卡| 国产在亚洲线视频观看| 亚洲精品影院久久久久久| 亚洲午夜AV无码专区在线播放 | 四虎影视在线永久免费看黄 | 日韩视频免费一区二区三区| 久久免费国产精品一区二区| 免费无码AV一区二区| 亚洲一区二区三区高清视频| 亚洲午夜国产精品无码| 日韩在线看片免费人成视频播放| 国产好大好硬好爽免费不卡| 免费又黄又爽又猛大片午夜 | 亚洲成a人片毛片在线| 日韩一卡2卡3卡4卡新区亚洲| 成人在线免费观看| 9277手机在线视频观看免费| 三级黄色免费观看| 美女裸免费观看网站| 亚洲三级在线观看| 亚洲经典在线观看| 亚洲国产成人精品不卡青青草原| 亚洲午夜无码片在线观看影院猛 | 亚洲av无码国产综合专区| 久久噜噜噜久久亚洲va久|