struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mansour <mansou...@yahoo.com>
Subject Re: intercept return, and Interceptor implementing ServletRequestAware
Date Mon, 16 Apr 2007 02:06:46 GMT
Dave Newton wrote:
> --- Mansour <mansour77@yahoo.com> wrote:
>   
>> What's the point then of having an action, if the
>> intercept method is going to execute the action. Why
>>     
>
>   
>> don't I just put the action code in an interceptor ?
>>     
>
> Because interceptors are normally called for *groups*
> of actions, not just one... just like it says in the
> first couple of paragraphs at the top of:
>
> http://struts.apache.org/2.x/docs/interceptors.html
>
> For instance, "validation" is a cross-cutting concern.
> So it makes sense to move it away from the code that
> decides what to to with the validated data.
>
>   
GOTCHA, so if I have a common method in all the action and I need to 
execute some code that is generic to all of them, then makes scenes to 
put in an interceptor. coooooool.

Ok, another question. If I have an custom interceptor does this sop 
another interceptor from execution. For example, I have this code:

    public String intercept(ActionInvocation invocation) throws Exception {
        AccountAction action = (AccountAction)invocation.getAction();
        return action.execute();
    }

shouldn't the interceptor that's responsible for setting the values on 
the action, gets executed too ?
in my case it's not. Why? here' my config:

<action name="accountAction"  class="billing.AccountAction" >
          <interceptor-ref name="prepareAccount"></interceptor-ref>
            <result name="SUCCESS">/pages/accountView.jsp</result>
             <result name="ERROR">/pages/exception.jsp</result>
             <result name="input">/pages/accountView.jsp</result>
        </action>



> Of course you *could* put all your action code into an
> interceptor and define an interceptor stack for every
> action-that-no-longer-had-an-action. There are many
> ways to make things harder--don't get me wrong, I
> applaud your efforts to find them.
>   

I am trying to make things easier :P but definitely always interested in 
finding a harder way :P
> You could put all your action code into filters, then
> you wouldn't even need servlets. Or put everything
> inside a JSP, then you wouldn't even need to compile
> or worry about whether or not your container
> hot-deploys.
>   
This will be a great idea. But then I will never be using struts. You 
know, it has to be used in a away or another. Someone must use it. It's 
unfair for the opensource community to write softwares and no one uses 
them. :P lol

> d.
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>   


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


Mime
View raw message