Announcement Announcement Module
No announcement yet.
Spring - Struts - Form bean life cycle problem Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring - Struts - Form bean life cycle problem

    Hi Spring Team

    I'm on a little problem today.
    I'm using Spring for IoC on a logical architecture as describe here :

    - Persistence Layer (Hibernate 3) + AbstractHibernateDao
    - Enterprise Layer
    - Application Layer
    - Presentation layer
    - Abstract presentation layer (no web-centric components here)
    - Struts presentation layer

    All layers are connected with under layer by Spring IoC.

    My problem is this one :

    Struts manage FormBean instances and keep reference on scope defined in struts-config (session, request, application,page?).

    The main component of my Abstract presentation Layer must be store in 'session' and directly depend on a actionForm. The simple way is reference this component in the apropriated FormBean.

    It's impossible by Spring IoC.

    Why :
    If i reference my component in the formBean inside my presentationLayer.xml (bean definition file for this layer), the life cycle of this formBean is managed by Spring and, by default, be a VM-Singleton.
    The Form bean must be Session-Singleton.

    Any way ?
    Possible to bind objects managed by Spring on a Session via ServletFilter like the OpenSessionInViewFilter for hibernateSession ?

    Thx a lot