cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grzegorz Kossakowski <g...@tuffmail.com>
Subject Re: How to get spring beans with Cocoon Template 1.0?
Date Thu, 20 Nov 2008 23:04:45 GMT
Thorsten Scherler pisze:
> On Thu, 2008-11-20 at 09:31 +0100, Thorsten Scherler wrote:
>> On Wed, 2008-11-19 at 22:06 +0800, 黄海冬公司邮箱 wrote:
>>> codes:
>>> 	<jx:set var="appctx"
>>> value="${cocoon.context.getAttribute(Packages.org.springframework.web.contex
>>> t.WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE)}"/>
>>> 	<jx:set var="bean" value="${appctx.getBean('bean')}"/>
>>>
>>> Roy Huang
>> Thanks very much Roy, will it try now.
> 
> Works like a charm, thanks again Roy!

There is one problem with this solution: it's ugly.

It introduces a dependency on very specific implementation that may change in the future.

Thorsten and Roy, if you really need to access some beans from expressions I suggest to add
them to
ObjectModel by implementing ObjectModelProvider interface. This way you can easily control
what
exactly the template can access and you remove dependency on specific implementation.

-- 
Grzegorz Kossakowski

Mime
View raw message