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:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



Reply via email to