click-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manuel Chinea <>
Subject Re: EJB 3.1 injection of a SessionBean in a click page
Date Mon, 12 Apr 2010 13:19:40 GMT
Hi Bob,

2010/4/12 Bob Schellink <>

> On 12/04/2010 11:00, Manuel Chinea wrote:
>  I guess a simple way to do this is doing the ctx.lookup of the SLSB.
>> Could/should it be done in a custom ConfigService or a TypeConverter
>> class in click? or better in a Superclass?
> ctx.lookup has been the approach used in EJB containers this far.
> I wouldn't use a superclass for this though. While its simple, the Page is
> not really the place to manage service lookup logic.

Ok, i meant more of a project-specific Page, like MyPage, not the Framework
specific Page.

> I'd recommend a ServiceFactory or ServiceLocator pattern, unless J2EE 6
> provides a way to inject services into POJOs directly.

Yeap, i saw this as a Plan B, combined with my project-specific Superclass

> Another approach is to subclass ClickServlet, override newPageInstance
> which passes in the pageClass to create, scan for @EJB annotated services
> and inject them manually. The SpringClickServlet does something similar, so
> have a look for some inspiration.

Ah, that is very interesting. I totally forgot about the ClickServlet!. I'll
take a look on that option. That way i'll learn a little bit more of Apache
Click in the process! ;).

> kind regards
> bob

Thnxs a lot!

Manuel Chinea.

View raw message