Re: looking for suggestion regarding interceptor

2008-07-10 Thread Chris Pratt
Oh, I see. Since we have a need to cache much of our data between requests (rather than fetching the data from the back end systems on every action request), we have more code that would have to be copied to each execute method (using your scheme). So in our case it relieves a lot of headaches to

Re: looking for suggestion regarding interceptor

2008-07-10 Thread Gabriel Belingueres
Spring only inject the service. The data returned by the service is holded into an instance variable of the action (or I could just store the data in session or application scope). Spring dependencies are wired this way: Service <--- Cache <--- DAO Ex: class MyAction extends ActionSupport {

Re: looking for suggestion regarding interceptor

2008-07-10 Thread Chris Pratt
I guess I'm confused. If Spring is injecting the data, why do you need it to also inject the Service? (*Chris*) On Thu, Jul 10, 2008 at 10:41 AM, Gabriel Belingueres <[EMAIL PROTECTED]> wrote: > IMHO both approaches are similar, as the intention is to inject the > required data when you need it

Re: looking for suggestion regarding interceptor

2008-07-10 Thread Gabriel Belingueres
IMHO both approaches are similar, as the intention is to inject the required data when you need it. The difference is that you created both an interface and an interceptor to perform the injection, while I relied on Spring to do this work. As a general rule I think on writing custom interceptors o

Re: looking for suggestion regarding interceptor

2008-07-10 Thread Chris Pratt
But then your Service Bean/DAO has to be injected into every Action that might need to load it and the code to check for the Data Object and load it, then store it to the context has to be Cut-n-Pasted between each of those Actions. Way too many chances for Cut-n-Paste errors or incomplete fixes f

Re: looking for suggestion regarding interceptor

2008-07-09 Thread Gabriel Belingueres
Wow it is amazing how S2 can be used. This is a use of interceptor I've never seen before. IMHO, I think it is too much trouble to declare an xxxAware interface and an xxxInterceptor to just share the same database data across multiple pages. I would stick to store the data in session or applicati

Re: looking for suggestion regarding interceptor

2008-07-09 Thread Chris Pratt
That's usually how I start. The one thing I usually add is an Aware interface that allows me to inject the value into my Actions when it's needed. So in your case I'd add a simple interface: interface CategoryListAware { void setCategoryList(List categories); } And at the end of your intercep

[OT] Re: looking for suggestion regarding interceptor

2008-07-09 Thread Dave Newton
--- On Wed, 7/9/08, Dhiraj Thakur <[EMAIL PROTECTED]> wrote: > There are 4 jsp page in which i want to show same category > by retrieving it from database. > What is the best way to do that? should i write a > intercepter which will retrieve Category from database > and store it in session? If i