Re: Prevent request filter invocation when struts action tag is invoked

2009-10-24 Thread Pancham

Here is my request filter code:
public class MyFilter implements Filter {
private FilterConfig filterConfig = null;
 
public void init(FilterConfig filterConfig)
throws ServletException {
this.filterConfig = filterConfig;
}

public void destroy() {
this.filterConfig = null;
}

public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException {
if (filterConfig == null)
return;
// MY CODE HERE
}


and here is the mapping in web.xml:

MyFilter
/*
REQUEST


While processing an request, if I include an action using struts action tag
("s:action"), this filter is invoked again during the same request. So, if I
have 2 "s:action" tags in my JSP, the filter is being called 3 times - once
for request and two times for "s:action".

Any ideas on how this could be addressed?


Musachy Barroso wrote:
> 
> What REQUEST FILTER is this you are talking about?
> 
> On Sat, Oct 10, 2009 at 10:15 PM, Pancham  wrote:
>> request filter
> 
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Prevent-request-filter-invocation-when-struts-action-tag-is-invoked-tp25824829p26045181.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 / Hibernate Question

2009-10-24 Thread Dennis Atkinson
Eduard,

I am still getting a ClassNotFound error on OpenSessionInViewFilter at startup.

I have found two jar files that contain the class, spring.jar and 
spring-hibernate3.jar, and it fails with both of them.

I have configured applicationContext.xml like this:






FLUSH_AUTO



is there anything else I have neglected to do?  Some other configuration, 
perhaps?

--Dennis






From: Eduard Neuwirt 
To: Struts Users Mailing List 
Sent: Sat, October 24, 2009 2:52:27 AM
Subject: Re: Struts2 / Hibernate Question

Hm,

interesting. I checked against my configurations. I have in my WEB-INF/lib 
spring.jar, all necessary hibernate archives and the configuration of filters 
is done as described  in the link I already posted.

Best
Eduard

Dennis Atkinson schrieb:
> OK, that's good.  So -- uh - how would I configure OpenSessionInView?  I 
> attempted to do it, but even after I loaded the spring-hibernate3-2.0.8.jar 
> file, I got a ClassNotFound error, so I couldn't even get past that. 
> And you are absolutely correct about it being rather interesting.  But it 
> seems so common, that there should be a common and standard way of dealing 
> with it, but so far it seems not.
> 
> --Dennis
> 
> 
> 
> 
> 
> 
> 
> From: Eduard Neuwirt 
> To: Struts Users Mailing List 
> Sent: Fri, October 23, 2009 3:19:09 PM
> Subject: Re: Struts2 / Hibernate Question
> 
> Hi Dennis,
> 
> sorry i don't know anything about FullHibernatePlugin. I am using only the 
> OpenSessionInView-approach. The Google delivers several threads to this 
> topic. It seems to be rather interesting problem.
> 
> Regards
> Eduard
> 
> Dennis Atkinson schrieb:
>  
>> Eduard,
>> 
>> I thought the FullHibernatePlugin implements this.
>> 
>> --Dennis
>> 
>> 
>> 
>> 
>> 
>> 
>> From: Eduard Neuwirt 
>> To: Struts Users Mailing List 
>> Sent: Fri, October 23, 2009 3:08:44 PM
>> Subject: Re: Struts2 / Hibernate Question
>> 
>> Hi,
>> 
>> please have a look to the https://www.hibernate.org/43.html
>> 
>> Regards
>> Eduard
>> 
>> Thomas Sattler schrieb:
>>  
>>> So it sounds like both the FullHibernatePlugin and the
>>> OpenSessionInViewFilter class work.  Thanks for the quick replies.
>>> 
>>> Do you remember how these are configured?
>>> 
>>> The FullHibernatePlugin wiki says only a few lines of configuration are
>>> required, but it doesn't say what those lines are.
>>> 
>>> With OpenSessionInView, I add it to my web.xml file, but I get an error that
>>> it can't find the class, even though I am fairly certain that the
>>> "spring-hibernate3-2.0.8.jar" file contains it, and I triple-check to make
>>> sure that jar is loaded.
>>> 
>>> 
>>> --Dennis
>>> 
>>> 
>>> 
>>> 
>>> 
>>> On Fri, Oct 23, 2009 at 2:35 PM, Eduard Neuwirt <
>>> eduard.neuw...@googlemail.com> wrote:
>>> 
>>>  
 Hi,
 
 Obviously there is a gap between Hibernate and Web-Application.
 OpenSessionInViewFilter working well, almost. I am using this filter and in
 the most cases it is enough. Sometimes I have to load Collection with
 size(). The another solution is to store only keys in the session and load
 the objects for every request from the Database/second level cash. The 
 Eager
 Initialization does not work for two or more Lists in the class :(
 
 Regards
 Eduard
 
 
 Dennis Atkinson schrieb:
 
  Hello all.

> I am running into the infamous "closed session" issue, whereby I get a
> LazyInitializationException on a lazy-initialized foreign key 
> relationship.
>  The issue, as I understand it, is that the session is closed before the
> lazy-initialized objects need to be read from the database, so there is no
> session when the read actually occurs, and the exception is thrown.  It
> seems like any complex Struts / Hibernate system would eventually run into
> this issue, as I have.  I could specify everything as "EAGER", but that
> would (eventually) load my entire database and that's far from an optimal
> solution.
> 
> As suggestions for fixing this, I have found references to the
> FullHibernatePlugin, and also the OpenSessionInViewFilter class.  Both 
> claim
> that no code changes are required, and all that's needed are some
> configuration changes.  The documentation on how to use these two 
> solutions
> is sparse, at best.
> Has anyone used either of these two solutions?  Is there any documentation
> floating around that I haven't found yet?  Or is there another, better
> solution that someone has found?
> I know this is a Hibernate issue and not a Struts issue, but I think
> people here must have experience with this issue.
> 
> Thanks in advance,
> Dennis
> 
> 
> 
> 
>