• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts with Spring and Hibernate

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My current mode of working with Java is very much as a desktop application programming language. When I need to develop a web application I tend to think PHP with a cool framework (like Qcodo) to keep it well designed and organized. But I long for one platform that can do it all, and while I know that Java can fill that void, I have always found Java to be cumbersome as a web application language.

In my research I have heard a lot of buzz about the stack of Java with Hibernate, Spring and Struts, but I cannot honestly say I understand each framework's role in implementing a web app. Could someone please help me clarify the role of Struts in web applications?

Thank you,
Brian
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Struts is a framework which is developed using the patterns like FrontController,Command patterns etc.So it will help you to process the request and response without doing much Scatter coding.You just need to configure the details in the xml.

Hibernate is also a open source framework used to develop a DAO layer.Again it will evade you from handling the statements.So atlast our application become database independent.

Spring is a mammoth frame work which have the various functionilty.Its upto you to decide how to use the SPring in your application.You can use it as a frame work or for persistent etc...

Thanks & regards,
Sitaraman
 
Ranch Hand
Posts: 471
Mac OS X Hibernate Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Brian,

Struts, spring and hibernate are three totally different frameworks. Since this is the struts forum, let's start with it. Struts is a web application framework that implements the front controller design pattern. Basically, there is a servlet which gets the users' requests, and decide which java class should handle this request (a struts action), and according to the result of this class' processing, which JSP should be processed to return output to the user. The front controller (the servlet) decides what to do according to a configuration file (typically called struts-config.xml). This is of course the most basic idea, but struts is much bigger than that. It has a validation framework to aid you validate the data entered by the users, and the tiles framework which helps you create custom complex layouts for your web application using simple JSPs glued together. Many more features are present.

Hibernate is an object relational mapping framework, meaning that instead of working with relational databases using JDBC, result sets, and all this complexity, you will be working with plain old java objects, without the need of writing a single SQL command. You map your database tables to your domain objects using XML mapping files. Using the configuration file, you can tell hibernate which SQL dialect to generate, as well as which data source.

Spring is, IMHO, the BEST enterprise framework ever. The core of spring is an inversion of Control (IoC) container, which helps you follow one of the best design principles, and that is to code to interfaces and not concrete classes. Spring has many modules, and one of the best features it has is that it can integrate with nearly any other framework it may need. It also provides some great templates to help you reduce the unnecessary code you write, and concentrate more on your application logic. You want JDBC? Use the JDBC template so that you don't have to create a connection, open it, then close and release it after you're done. You want hibernate? Use the hibernate template so that you don't have to create a session, open it, create a transaction, commit the transaction and close the session after you're done. Transaction management? You got it. Mail? No problem. You would practically find anything you might need in the spring framework, or at least you would find integration with the framework of your choice, with lots of utilities to make your life easier.

Hope this clarifies things for you, and sorry for the long post.
 
reply
    Bookmark Topic Watch Topic
  • New Topic