With  OpenSessionInViewFilter, my web.xml will look like this

<filter>
  <filter-name>struts2</filter-name>
  <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter>
  <filter-name>sessionFilter</filter-name>
  
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
  <filter-name>struts2</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
  <filter-name>sessionFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>


Does it cause any conflict when both struts2 and sessionFilter are
mapped to the same URL pattern?



On 8/22/07, Toni Lyytikäinen <[EMAIL PROTECTED]> wrote:
> You can't use the OpenSessionInViewInterceptor from Spring in Struts 2.
> Struts 2 interceptors are not compatible with Spring interceptors as they
> have their own interface. You'll have to use OpenSessionInViewFilter. Take a
> look here:
>
> http://www.springframework.org/docs/api/org/springframework/orm/hibernate/support/OpenSessionInViewFilter.html
>
>
>
> On 8/22/07, hezjing <[EMAIL PROTECTED]> wrote:
> >
> > Hi
> >
> > I'm encountering this exception (when trying to iterate a list of
> > orders for a specific customer in JSP),
> >
> > failed to lazily initialize a collection of role:
> > com.dummy.Customer.orders, no session or session was closed
> > at
> > org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException
> > (AbstractPersistentCollection.java:358)
> > at
> > org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected
> > (AbstractPersistentCollection.java:350)
> > at org.hibernate.collection.AbstractPersistentCollection.initialize(
> > AbstractPersistentCollection.java:343)
> > at org.hibernate.collection.AbstractPersistentCollection.read(
> > AbstractPersistentCollection.java:86)
> > at org.hibernate.collection.PersistentBag.iterator(PersistentBag.java:249)
> > at org.apache.struts2.util.MakeIterator.convert(MakeIterator.java:81)
> > ......
> >
> > I'm using Struts 2, Hibernate and Spring (for creating actions, DAOs and
> > etc).
> >
> > I read that Spring's OpenSessionInViewInterceptor will resolve this
> > problem but can you describe how to configure
> > OpenSessionInViewInterceptor in Struts2?
> >
> > And, is there a better alternative than using
> > OpenSessionInViewInterceptor?
> >
> >
> >
> > --
> >
> > Hez
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>


-- 

Hez

Reply via email to