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?
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 ]
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
posted
0
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
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.