开发者

Is Spring MVC a Replacement for Servlet/JSP/Beans MVC Model

开发者 https://www.devze.com 2023-04-08 21:30 出处:网络
I apologize for the \"noobness\" of this question, but I\'ve recently been studing JSP/Servlets that I will be using primar开发者_Go百科ily to build web applications/dynamic websites. I really like th

I apologize for the "noobness" of this question, but I've recently been studing JSP/Servlets that I will be using primar开发者_Go百科ily to build web applications/dynamic websites. I really like the design model of using servlets to do the business logic (code), jsp to design and display, and beans to display the dynamic content in the jsp page.

I've been reading a lot about Spring MVC and i'm confused on whether or not its a replacement for the design model I just described, or is it geared more towards desktop java apps or perhaps something else.

Any insight or advice would be well received.


Actually those 2 are quite different. The Java way of using JSPs and servlets is the Model2 paradigm, in which you'd have you JSP as views, your servlets as controllers and standard Java beans as models. MVC is a more comprehensive paradigm, you still have a model a view and a controller but they're not stuck to being Java beans, JSPs and servlets respectivelly. Spring MVC offers a nice implemententation of the paradigm, allowing you to have whatever you want as controller, multiple technologies besides JSP as views, and the model is pretty free too. Plus it gives you a lot of extra stuff besides the MVC, like the abiltity to make wizards, etc.


Spring MVC framework provides rich functionality for building robust Web Applications.
Its MVC modeled and acts as an wrapper over servlets, providing a neat easy to use interface.
All interfaces are tightly coupled to the Servlet API. This coupling makes sure that the features of the Servlet API remain available to developers while offering a high abstraction framework to ease working with said API.
Also bundled with it is the bean model.

You can still use JSP as the view layer with Spring MVC, as it does not have its own view language.
It provides option for velocity, freemarker and much more.

More info @ http://static.springsource.org/spring/docs/current/spring-framework-reference/html/mvc.html


A portion of Spring is a web framework, though Spring can also be used for non-web apps. It can definitely be a replacement for what you desribed, but it can also be so much more. I encourage you to read the spring docs at http://docs.spring.io/spring/docs/current/spring-framework-reference/html/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号