aspose file tools*
The moose likes Struts and the fly likes Struts2 Extending the FilterDispatcher Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 Extending the FilterDispatcher" Watch "Struts2 Extending the FilterDispatcher" New topic
Author

Struts2 Extending the FilterDispatcher

RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528

Will it be a good practice to extend the Struts Fraewroks FilterDispatcher ?

I am trying to use Hibernate with Struts .Will it be a good pratice if i extend the FilterDispacther for calling Hibernate Utility classes ??

Anyone any views i want to discuss the Pros and cons with this approach.


If you want something you never had do something which you had never done
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

There is absolutely no reason to extend the dispatcher to do anything with Hibernate; this kind of thing is precisely what interceptors are for.

I'm assuming you're taking about creating an open-session-in-view-/OPSiV-style solution. Whether or not this is always the best solution is debatable; naive usage can lead to unexpected loss of performance in JSP pages due to lazy initialization.

Personally, I've switched over to using Spring's transaction support (there are similar solutions besides Spring) and have found it pretty handy. I also tend to initialize only the data I know will be used in the JSP to avoid the aforementioned performance hits, but part of that is due to some of the complicated data structures I've worked with lately and their expensive SQL queries.
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
Thanks,

Now thinking to learn spring for this integration purpose.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2 Extending the FilterDispatcher