aspose file tools*
The moose likes Struts and the fly likes Advantages of Spring over Struts? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Advantages of Spring over Struts?" Watch "Advantages of Spring over Struts?" New topic
Author

Advantages of Spring over Struts?

Sunil Manheri
Ranch Hand

Joined: Jul 07, 2004
Posts: 32
Hi all,
I am using Struts for a long time and I found it to be a very useful, easy to use powerful framework. What are the advantages of String over Struts?
Regards,
Sunil Manheri.


TechMindViews - Technical Notes
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Spring includes:

* Powerful JavaBeans-based configuration management, applying Inversion-of-Control principles. This makes wiring up applications quick and easy. No more singletons littered throughout your codebase, no more arbitrary properties files: one consistent and elegant approach everywhere. This core bean factory can be used in any environment, from applets to J2EE containers.
* Generic abstraction layer for transaction management, allowing for pluggable transaction managers, and making it easy to demarcate transactions without dealing with low-level issues. Generic strategies for JTA and a single JDBC DataSource are included. In contrast to plain JTA or EJB CMT, Spring's transaction support is not tied to J2EE environments.
* JDBC abstraction layer that offers a meaningful exception hierarchy (no more pulling vendor codes out of SQLException), simplifies error handling, and greatly reduces the amount of code you'll need to write. You'll never need to write another finally block to use JDBC again. The JDBC-oriented exceptions comply to Spring's generic DAO exception hierarchy.
* Integration with Hibernate, JDO, and iBATIS SQL Maps: in terms of resource holders, DAO implementation support, and transaction strategies. First-class Hibernate support with lots of IoC convenience features, addressing many typical Hibernate integration issues. All of these comply to Spring's generic transaction and DAO exception hierarchies.
* AOP functionality, fully integrated into Spring configuration management. You can AOP-enable any object managed by Spring, adding aspects such as declarative transaction management. With Spring, you can have declarative transaction management without EJB... even without JTA, if you're using a single database in Tomcat or another web container without JTA support.
* Flexible MVC web application framework, built on core Spring functionality. This framework is highly configurable via strategy interfaces, and accommodates multiple view technologies like JSP, Velocity, Tiles, iText, and POI. Note that a Spring middle tier can easily be combined with a web tier based on any other web MVC framework, like Struts, WebWork, or Tapestry.


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Matt Raible
author
Ranch Hand

Joined: Jan 11, 2001
Posts: 114
Originally posted by Sunil Manheri:
Hi all,
I am using Struts for a long time and I found it to be a very useful, easy to use powerful framework. What are the advantages of String over Struts?
Regards,
Sunil Manheri.


Struts is a web application framework, whereas Spring is a "whole" application framework. It makes it easier to develop your backend and your middle-tier. While it has a MVC framework, it also has good support classes for the popular frameworks. In fact, it has a

whole bunch of classes for Struts - including the ContextLoaderPlugin, which allows you to use dependency injection in your actions, and even treat them like WebWork Actions - where a new instance is created for every request.


Matt<br /> <br />Author: <a href="http://springlive.com" target="_blank" rel="nofollow">Spring Live</a> and <a href="http://www.apress.com/book/bookDisplay.html?bID=256" target="_blank" rel="nofollow">Pro JSP</a><br />Weblogs: <a href="http://raibledesigns.com" target="_blank" rel="nofollow">Raible Designs</a> <a href="http://jroller.com/page/raible" target="_blank" rel="nofollow">Spring Live Blog</a>
Sunil Manheri
Ranch Hand

Joined: Jul 07, 2004
Posts: 32
Thanks for the reply.

We have Struts web framework and EJB for backend, and it fits perfect, then why I have to go for Spring?
Matt Raible
author
Ranch Hand

Joined: Jan 11, 2001
Posts: 114
Originally posted by Sunil Manheri:
Thanks for the reply.

We have Struts web framework and EJB for backend, and it fits perfect, then why I have to go for Spring?


If it fits perfect, there's no reason for you to change - is there? Spring is great for new development, especially if you're developing with a test-first methodology. If you have a working application and its in production - why would you refactor it to use the latest technologies? If it ain't broke - don't fix it.
 
 
subject: Advantages of Spring over Struts?