views:

137

answers:

1

This may be a long shot question..

I am working on an application that is based on JSP/Javascript only (without a Web framework!)

Is there a way to have depencency injection for JSP beans? By jsp beans I mean beans defined like this

<jsp:useBean id="cart" scope="session" class="session.Carts" />

Is there a way/library/hack to intercept the bean creation so that when "cart" is referenced for the first time, some some of injection takes place?

Can I define somewhere a "listener" for JSP beans (like you can do for JSF beans for example)?

I am free to do anything I want in the back-end, but I cannot add a web framework in the front-end (Don't ask!)

A: 

Yes, with spring and AspectJ - using @Configurable and <context:load-time-weaver/> (read the aop section of spring docs)

Bozho
Nice! I never thought that it was possible! You have deep knowledge of everything Java related.
kazanaki