aspose file tools*
The moose likes Other Application Frameworks and the fly likes Spring MVC over existing Sturts project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Spring MVC over existing Sturts project" Watch "Spring MVC over existing Sturts project" New topic
Author

Spring MVC over existing Sturts project

Jehan Jaleel
Ranch Hand

Joined: Apr 30, 2002
Posts: 196
Hi all,
I have a web project that was done with Sturts. I am doing some enhancments to this project (adding a few new screens and new functionality).

Would it be possible to do these enhancements in Spring MVC although it is a Struts project? Would there be any conflicts between the Spring and Struts components and files?

Thanks for any advice.
Paras Jain
Ranch Hand

Joined: Feb 26, 2005
Posts: 137
Hi,
To me it doesn't make much sense to switch from MVC framework to another(in your case Struts to SpringMVC) just for a few new screens and enhancements.

But you can make use of Spring's Dependency Injection (IoC) container and Spring's Action support by using Struts with just Spring Core(instead of Spring MVC).

Regards,
Paras
[ November 13, 2008: Message edited by: Paras Jain ]

Paras Jain
SCJP 5.0
Jehan Jaleel
Ranch Hand

Joined: Apr 30, 2002
Posts: 196
Thanks for your reply and advice. I understand what you are saying.

The reason I want to use Spring MVC is because for the enhacements I am doing I want to reuse some code and some JSPs that were already done for another Spring MVC project.

My concern is would there be any conflict between Struts and Spring MVC. Would some web containers not like it?

Thanks.
Paras Jain
Ranch Hand

Joined: Feb 26, 2005
Posts: 137
Well I think Spring and Struts could co-exist, but I have hardly seen such combination. And yes as you said, containers may do some funny things because of possible conflicts at some places
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Bot can co-exist, you can even integrate Spring with your Struts Action. To do that you have your Action extend ActionSupport from Spring, which extends Struts Action class, but also has the nice ability to access the Application Context that you load when deploying your war file.

For both co-existing, is that the URLs that are already using Struts, keep them using Struts, but for new URLs, map tham in Spring to Spring MVC Controller classes instead of Struts Action classes.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring MVC over existing Sturts project
 
Similar Threads
About Struts version
MVC for spring+hibernate projects
Security Constraints in web.xml
Springļæ½s ROI
Is this right architecture