Overview package class us Tree Deprecated Index Help Prev Class next classframes no frames
script> all classes
All classes
Summary: Nested | Field | Constr | MethodDetail: Field | Constr | Method
Org.apache.struts.Actions Class Lookupdispatchaction
Java.lang.object
Org.apache.struts.Action.action
Org.apache.struts.Actions.dispatchaction
Org.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:
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: Submit> html: Submit> html: form> Your Subclass Must Implement Both getKeyMethodMap and the methods defined in the map. An esample of selfh itemations 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 Ten An Exception Will Be Thrown. You Can Override THE Method unspecified to provide a custom handler. if the submit WAS Cancelle (a HTML: Cancel Button Was Pressed), The Custom Handler ca Zantelled will be used instead. Field SummaryProtected Java.util.mapKeymethodmap Resource Key to Method Name Lookup.protaced Java.util.maplocalemap Reverse Lookup Map from Resource Value To Resource Key. Fields inherited from class org.apache.struts.Actions.Dispatchactionclazz, log, message, methods, types Fields inherited from class org.apache.struts.Action.ActionDefaultlocale, servlet Constructor SummarylookUpdispatchaction () 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.DispatchActioncancelled, dispatchMethod, getMethod, unspecified Methods inherited from class org.apache.struts.action.ActionaddErrors, 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.ObjectClone, Equals, Finalize, Getclass, Hashcode, Notify, Notifyall, Tostring, Wait, Wait, Wait Field detail Localemappprotected java.util.map localmap 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 ActionForward Execute (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 shouth be forwarded, or Null if The Response HAS Already been completed. OVERRIDES: Execute in class Dispatchaction Parameters: Mapping - the actionMapping use 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 controls. Throws: Java.lang.Exception - IF An Error Occurs InitlookupMap Private java.util.map initlookupMap (javax.servlet.http.httpservletRequest request, Java.util.locale UserLocale) . 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 use 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 use 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 Overview package class us Tree Deprecated Index Help Prev Class next classframes no frames script> all classes All classes Summary: Nested | Field | Constr | MethodDetail: Field | Constr | Method Copyright © 2000-2004 - The Apache Software Foundation