I worked in Struts and now learning Spring.My doubt is, are these frameworks complete,in the sense that addresses all issues developer face while developing web applications.No single framework seems to be complete in addressing all the issues related in developing Web Application (this is my opinion)
Listed a very few points(rather my opinions) in using these frameworks in various layers of web frame works(I'm may be wrong)
Presentation Layer ================= Why Struts?
1.Struts is a framework that implements Model-View-Controller (MVC) framework. The main purpose of an MVC framework is to separate presentation code and business logic code 2.Support for Internationalization 3.Support for HTML Tag Library 4.Support for Validation Framework (validation_rules.xml)
Why Not Spring for Presentation Layer?
1.There is no common parent controller for Request Handling, similar to Struts ActionServlet 2.More JSP Coding 3.Takes more development time ??(not sure about this)
Business Layer =================================
1.Easily Switch from one persistence framework (like Hibernate) to another 2.Built in support for persistence framework like Hibernate 3.Business Objects can be modeled as services and can be looked up from Presentation Layer. 4.Uses the design pattern Dependency Injection
Why not Struts for Business Layer?
1.In most of the cases Business Logic will be written in org.apache.struts.Action class, which will lead to dependencies between Presentation and Business Layer 2.No Built in Support for any Persistence frameworks 3.Since Presentation and Business Layer is more tightly coupled it will be difficult to move from one Persistence framework to another.
I think its a bit like comparing apple with oranges. Struts is a framework specifically and only for web layer (as far as I know). Spring is a framework for all kinds of different layers needed in an app like database access, business logic and web. It even provides support for web-alternative client technologies like RichClient project. And Spring has classes for struts-support, also. In many aspects spring behaves like a "meta-framework". It provides interfaces and classes, which are specifically targeted at integrating other frameworks in spring.
IOC in my view is especially usefull to drastically reduce lines of codes for inter layer communications.
The focus of struts and spring is very different and so it does not make much sense to compare both. Spring has its own webframework, so you might compare this with struts. So spring (the whole thing) - struts comparision might be not comparing apple with orange, but apple-tree with apple (which does not make much sense either).
What do you have in that there bucket? It wouldn't be a tiny ad by any chance ...