struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hezjing <hezj...@gmail.com>
Subject Re: Configuring OpenSessionInViewInterceptor as S2's interceptor
Date Wed, 22 Aug 2007 08:59:43 GMT
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 <tolyen@gmail.com> 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 <hezjing@gmail.com> 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: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>


-- 

Hez
Mime
View raw message