简体   繁体   English

struts2和spring MVC有什么区别

[英]What the difference between struts2 and spring MVC

I am learning Java EE and wanna build up a complete management system for a restaurant. 我正在学习Java EE,并希望为餐厅建立完整的管理系统。 Now I am confused what presentation layer should I use for my RMS because I heard that the struts 2 is one of the best UI layer but, the thing is, if I am using spring for my business logic layer then I can use the spring MVC can't I? 现在,我很困惑应该为RMS使用什么表示层,因为听说struts 2是最好的UI层之一,但是问题是,如果我将spring用于业务逻辑层,则可以使用spring MVC不能吗 By the way, I am really interested to build a complete application which is follow the multi-tier architecture. 顺便说一句,我真的很想构建一个遵循多层体系结构的完整应用程序。

Yes, of course you can use Spring MVC. 是的,您当然可以使用Spring MVC。

You can use Struts 2 if you'd like as well, because Spring integrates with it nicely. 如果需要的话,也可以使用Struts 2,因为Spring与它很好地集成在一起。

But I don't see any reason why you'd want to do that. 但我看不出您为什么要这样做。 The person who told you that Struts 2 is 告诉你Struts 2的人是

one of the best UI layer [sic] 最好的UI层之一[原文如此]

is misguided. 被误导了。 If you compare it to Spring MVC, you'll see that the two are based on similar ideas, but Spring improves on Struts. 如果将其与Spring MVC进行比较,您会发现两者基于相似的思想,但是Spring在Struts上有所改进。 JSF has superceded Struts as the default Java EE web view technology, so it's not even considered "best" by the Java EE standard. JSF已取代Struts作为默认的Java EE Web视图技术,因此Java EE标准甚至没有将它视为“最佳”。

Stick with Spring. 坚持春天。 You won't be sorry. 你不会后悔的

I will not blame struts 2, indeed it's a great product, I work with it every day. 我不会责怪struts 2,的确是个很棒的产品,我每天都在使用它。 But in my experience spring MVC is a lot simpler and clearer. 但是以我的经验,春季MVC更加简单明了。 This doesn't mean you don't get as much features. 这并不意味着您没有获得太多功能。

Try both, and you'll see what I mean. 两者同时尝试,您会明白我的意思。 Tell us which one you choose! 告诉我们您选择哪一个!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM