struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MLENEV...@abusinessware.com
Subject Re: [s2]Would like each action to go throught my parent class
Date Wed, 18 Apr 2007 09:33:05 GMT
I was talking about a "dynamic" mecanism. In Struts 1, I never called 
super.dispathMethod() : the CRMAction.dispatchMethod() was first called by 
Struts, then my "return super.dispatchMethod()" was returning the 
ActionForward returned by my called Action.

public class CRMAction extends DispatchAction {
        protected ActionForward dispatchMethod(ActionMapping mapping, 
ActionForm form, HttpServletRequest request, HttpServletResponse response, 
String name) throws Exception {
                try{
                        log.debug("CRM dispatchMethod.debut");
                        UserBean user = getConnectedUser(request);
                        if(user==null) {
                                log.error("User null !");
                                return mapping.findForward("error");
                        }
                        return super.dispatchMethod(mapping, form, 
request, response, name);
                } catch (Exception e) {
                        log.error(e.getMessage());
                        return mapping.findForward("error");
                }
        }

Regards,

Michaƫl




--- MLENEVEUT@abusinessware.com wrote:
> My parent Action : 
> public class CRMAction extends ActionSupport
>         @Override
>         public String execute() throws Exception {
>                 //do all tests (user logged, ...)
>                 //...
>                 return super.execute();
>         }
> }
> 
> My others Actions :
> public class LoginAction extends CRMAction {
>         public String myMethod () {
>                 //do something
>                 return "myForward";
>         }
> }
> 
> But I never go in CRMAction.execute()...

You never call super.execute() in your subclass.

d.




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message