• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts2 Extending the FilterDispatcher

 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,

Now thinking to learn spring for this integration purpose.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic