This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring MVC over existing Sturts project

 
Jehan Jaleel
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Jehan Jaleel
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic