[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-user
Subject:    Re: LookupDispatchAction "default" value?
From:       Danny Mui <danny () muibros ! com>
Date:       2002-10-31 22:42:35
[Download RAW message or body]

Sorry to have muddled the waters too much, I assumed too much...Having 
looked at the LookupDispatchAction code, I can now make a slightly more 
educated reply ;).

Yeah I think you're going to have to workaround the parent method.


public class DefaultLookup extends LookupDispatchAction {

public ActionForward execute(.....){
    if (request.getParameter(mapping.getParameter()) == null)  {

        return defaultMethod(....)
    } else return super.execute(....);
}

public abstract ActionForward defaultMethod(....) ;
}

This should work! i think...

danny


Wendy Smoak wrote:

>Danny Mui wrote:
>  
>
>>I extended the dispatch action to do something like that:
>>in execute() {
>>      ActionForward forward = null;
>>
>>       if (mapping.getParameter() == null ||
>>    
>>
>"".equals(mapping.getParameter())) {
>  
>
>>           forward = executeAction(mapping, form, request, response);
>>       } else {
>>           forward = super.dispatchMethod(mapping,form,request,response,
>>    
>>
>mapping.getParameter());
>  
>
>>       }
>>       return forward;
>>}
>>i'm a little weirder, i like to declaratively tell my action which to 
>>execute.  so extending the if statement to look at the request/form is 
>>possible.
>>this may not be lookupdispatchaction but close enough i guess?
>>    
>>
>
>I don't quite understand where this code lives.  Is this in a class that
>extends "Action"?  Or have you subclassed LookupDispatchAction and "fixed"
>the execute() method?
>
>  
>




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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic