struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oscar <oscar.kalde...@gmail.com>
Subject Re: Question about PrepareInterceptor and Preparable
Date Mon, 16 Nov 2009 21:58:28 GMT
Chris Pratt escribió:
> Did you either set your appInterceptors stack to be the default stack, or
> define the actions you're testing with to use the appInterceptors stack
> explicitly?  Otherwise, you're actually just using the defaultStack.
>   (*Chris*)
>
> On Mon, Nov 16, 2009 at 12:34 PM, Oscar <oscar.kalderon@gmail.com> wrote:
>
>   
>> Hi to all. I'm developing a Struts 2 application and i create an
>> interceptor to initialize values and to validate user login. I want to load
>> a list to jsp to populate a s:select so i implemented the Preparable
>> interface in my action, and the method prepare(), so i type the code in this
>> method to get the list from DB. For that i supposed that my custom
>> interceptor will execute before the prepare method because in my interceptor
>> i initialize my connection that i use on prepare(), but perpare() executes
>> before that, so it gives me a NullPointerException.
>>
>> Then i googled about it and i found something about PrepareInterceptor, so
>> i defined in my interceptor stack after my own interceptor, like this:
>>
>> <interceptor-stack name="appInteceptors">
>> <interceptor-ref name="initializeInterceptor" />
>>               <interceptor-ref name="prepare" />
>>               <!--<interceptor-ref name="permissionsInterceptor" />-->
>>               <interceptor-ref name="defaultStack" />
>> </interceptor-stack>
>>
>> But it doesn't work, because i tought that with the order change my
>> interceptor will execute before than action's prepare() method, but don't.
>>
>> Somebody knows how to execute prepare() after a custom interceptor
>> execution?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>     
>
> Well Chris, you're right, i didn't realize that i don't specified my action to use that
interceptor stack, i've been specified a default stack for all the package but in some moment
i deleted it and i don't see that
Thanks and sorry for that.


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


Mime
View raw message