On Sunday 15 March 2009 11:07:53 PEGASUS84 wrote:
> i've created this interceptor,
> does spmeone know why it doesn't work?
>
[snip]
>
> <action ....>
>
> <intercpetor-ref name="filtro">
>
> </action>

When you use <interceptor-ref> you are overwriting the current stack with 
whatever you specify. So, this is now the only interceptor that runs on your 
action. I'm guessing that is related to why it doesn't work. Try adding 
another stack like this - 

<action ...>
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="filtro" />
</action>

You do have to be aware of a few things when writing interceptors, first off, 
the defaultStack will likely do things during processing that will affect your 
action's processing. If you are looking into the session, make sure that your 
interceptor falls into place in processing where all of your dependencies are 
met. Also, don't put it too late in the stack that your action has already 
been populated and your method called if you are authenticating. If you are 
looking at building an authentication/authorization interceptor stack, check 
out mark menard's tutorial on the subject - 

http://www.vitarara.org/cms/struts_2_cookbook/creating_a_login_interceptor

It is likely exactly what you're looking for.

-Wes

-- 

Wes Wannemacher
Author - Struts 2 In Practice 
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher


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

Reply via email to