SiSi'mon schrieb:
I am not sure what a session scoped component binding is.

do you mean a session scoped backing bean?  We are using Spring IOC to
manage the backing beans and only have one that is session scoped.

thanks

Si'mon



Well following, if you have referenced this bean into something like:

<component binding="#{sessionbeanbean.bindingattribute}" /> and this bean is session scoped or even worse application scoped in spring then you run into this problem.


You can however since you use spring anyway and if you do not want to omit the session scope of your bean make the binding request scoped nevertheless.

Spring 2 has the aop:scoped proxy mechanism, which you can use to wrap a request scoped proxy once the session scoped bean references your binding object around it.

Which means a contstruct like that:

<component binding="#{sessionbeanbean.componentbindingholder.bindingattribute}" /> can work even if the bean is session scoped if the componentbindingholder is request scoped and has the aop:proxy construct around it.
(Sorry for going so deeply into spring)

what this means is following:


<bean id="componentbindingholder" scope="request">
   <aop:scoped-proxy />
</bean>

<bean id="sessionbean" scope="session" class="....">
        <property name="componentbindingholder"
                        ref="componentbindingholder" />

</bean>

what happens now is
that both beans are ioc glued together but, the contents of the componentbindingholder is dropped at every request, while its proxy shell stays the same the entire session.

Sorry for digging in so deep into spring, but this stuff is pure genious and definitely a good way to avoid the session scoped component binding problem. (It is a must have if you start to work with conversation based frameworks)


Werner

Reply via email to