Server side MVC +Client side MVC

2019-04-06 03:56发布

An application is both JS intensive and has a complex business logic +huge data flow that uses backboneJS to structure JavaScript code and there is a necessity for the server side MVC also (Spring in this case).

  1. Is it a good idea to implement server side MVC (spring ) along with client side MVC (backbone) and are there any compatibility issues between them?
  2. In case both can be implemented.How am i going to coordinate the spring views with the backbone view.
  3. How will client side MVC with template engine collaborate with 'View' of Spring.

Though this question has been asked before, I could not find suitable answer for this. Can somebody help me with a detailed answer?

2条回答
淡お忘
2楼-- · 2019-04-06 04:15

Backbone.js is primarily used for SPA's (Single Page Applications). Your backbone.js segments ('views') are rendered and re-rendered by data, that is fetched or changed. If your application is going to be javascript intensive, backbone is a great minimal framework that will help organize your application. However, backbone is not so simple when your javascript application becomes quite large. You have to have a thorough understanding of the fundamentals of javascript and have a programming decided pattern. Otherwise you application can become quite a mess even with the use of backbone.js.

Anyhow I digress. Think of you client side application (backbone.js driven) completely separate from your server side application (MVC driven). All your client application needs from your server application is the data. That is why backbone.js is built around a REST API. If you are looking to develop a large javascript application, I would look at using MVC 4's Web API for your REST API, and backbone.js to help organize and standardize your client application.

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-04-06 04:22

This article describes how to make an application architecture with both server side MVC and JS MVC , respecting the MVC pattern. http://blog.javascriptmvc.com/?p=68

查看更多
登录 后发表回答