struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Hill" <andrew.david.h...@gridnode.com>
Subject RE: Multiple submit buttons
Date Tue, 17 Dec 2002 03:16:41 GMT
Nah, you cant extend two classes unfortunately. (Maybe if a c++ version of
struts is ever written ;->)
Your best bet might be to copy and paste the relevant code from the
LookupDispatchAction source and create your own LookupDispatchAction version
that inherits your BaseAction class. Im doing this with DispatchActions.
This works fine, only downside is that if you upgrade your struts version
later, your own LookupDispatchAction will still be using the old code...

-----Original Message-----
From: Heligon Sandra [mailto:sandra.heligon@nextream.fr]
Sent: Tuesday, December 17, 2002 00:58
To: 'Struts Users Mailing List'
Subject: RE: Multiple submit buttons


all the actions of my application extends a BaseAction class.
It is possible that the DefaultLookupAction extends from two
classes, isn't it ?
I tried to do that with RationalRose but I have an error message
but I think that it this problem is specific to RationalRose unless that is
not recommended
in object's modelisation(UML)?

-----Original Message-----
From: Scott Reisdorf [mailto:reisdorf1@llnl.gov]
Sent: 16 December 2002 17:46
To: Struts Users Mailing List
Subject: Re: Multiple submit buttons


You are right....use the LookDispatchAction
you just need something like the followingm, where the mapping parameters
represent the .properties file attributes.

your jsp will look like the following:

html:submit property="action">
bean:message key="button.lookupAmazonAuthor"/>
</html:submit>

html:submit property="action">
bean:message key="button.lookupAmazonKeyword"/>
</html:submit>

Your Java Class will look like the following:

public class BookLookupDispatchAction extends LookupDispatchAction {


   protected Map getKeyMethodMap() {
     Map map = new HashMap();
     map.put("button.lookupAmazonAsin", "lookupAmazonBookByAsin" );
     map.put("button.lookupAmazonKeyword", "lookupAmazonBookByKeyword" );
     map.put("button.lookupAmazonAuthor","lookupAmazonBookByAuthor");
     return map;
   }

   public ActionForward lookupAmazonBookByAsin(ActionMapping mapping,
                             ActionForm form,
                             HttpServletRequest request,
                             HttpServletResponse response)
     throws Exception {
       ...
         }

  public ActionForward lookupAmazonBookByKeyword(ActionMapping mapping,
                             ActionForm form,
                             HttpServletRequest request,
                             HttpServletResponse response)
     throws Exception {

          ....



etc...

Hope this helps.


At 05:34 PM 12/16/2002 +0100, you wrote:

>         I know that this topic with already evoked in the preceding
>messages, but I have evil to make a synthesis.
>         When a form has several buttons submit (save, update, delete,
>cancel, create ...) to perform the action, but
>         what it is the best method?
>         1) <input type = "submit" name= "update_submit"
value="<bean:message
>
>         in the action class
>         if (pRequest.getParameter("update_submit")!=null){
>         }else ...
>         2) use the LookDispatchAction
>(http://www.husted.com/struts/tips/003.html)
>         3) JavaScript with hidden field
>         I tend to think that the best method is the second is really the
>case?
>         To use  LookDispatchAction I must create a subclass that extends
>LookDispatchAction, isn't it ?
>         Are there disadvantages to use LookDispatchAction ?
>
>
>
>
>
>
>
>
>--
>To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message