简体   繁体   English

有关基于ASP.NET MVC2的富客户端Web应用程序的前端实现的建议

[英]Advice on front end implementation of rich client web app based on ASP.NET MVC2

We use MVC2 to build up our web app. 我们使用MVC2来构建我们的Web应用程序。 There are some complicated pages in our project. 我们的项目中有一些复杂的页面。 They have plenty of user interactivities, realtime stock data and charts, requiring no page refresh. 它们具有大量的用户交互性,实时的库存数据和图表,不需要刷新页面。

I am new to front end development and ASP.NET MVC2. 我是前端开发和ASP.NET MVC2的新手。 After using it for a while I think it's a form-based framework for presentation layer(I maybe wrong). 使用一段时间后,我认为它是用于表示层的基于表单的框架(我可能错了)。 If most UI actions are excuted inside one web page, using ajax and javascript to render data and run UI logic seems better. 如果大多数UI操作是在一个网页内执行的,则使用Ajax和javascript渲染数据并运行UI逻辑似乎更好。

Then I find there're two way to rendering UI in our app: binding UI model to View using MVC2 and filling the view using javascript. 然后,我发现有两种方法可以在我们的应用程序中呈现UI:使用MVC2将UI模型绑定到View以及使用javascript填充视图。 This seems not so elegant or may possibly mess if more and more views are implemented. 如果实现了越来越多的视图,这似乎并不那么优雅,或者可能会变得混乱。

It seems MVC2 controller is good at being RESTful UI model data provider. 看来MVC2控制器擅长于成为RESTful UI模型数据提供者。 So I think make the solution as Controller(model data)->HTML layouts + javascript(ui logic) could be a good way to implement such a rich client web app. 因此,我认为将解决方案作为Controller(模型数据)-> HTML布局+ javascript(ui逻辑)可能是实现此类富客户端Web应用程序的好方法。 Is it a good practice to do? 这是一个好习惯吗? Or what's your advice on this kind of project? 或您对此类项目有何建议? Are there any web resources(articles or sample projects) for reference? 是否有任何网络资源(文章或示例项目)可供参考?

Thanks a lot. 非常感谢。

It's not a bad practice to make your actions return just data, you could make your actions return JSon objects since they are lightweight and use JSonP to make ajax request across different domains. 使您的操作仅返回数据不是一个坏习惯,您可以使您的操作返回JSon对象,因为它们是轻量级的,并且可以使用JSonP在不同域中发出Ajax请求。 You can try the new template JQuery PlugIn to render your views. 您可以尝试使用新的模板JQuery PlugIn呈现视图。

My suggestion would be to build up your application such that it works without JavaScript. 我的建议是建立您的应用程序,使其无需JavaScript就可以工作。 Then use JQuery (a JavaScript library) and Ajax to improve the user experience. 然后使用JQuery(JavaScript库)和Ajax改善用户体验。

Be aware that it is entirely possible that your RIA needs go beyond what one can do with Jquery. 请注意,您的RIA需求完全有可能超出Jquery的能力范围。 In these scenarios one might consider another solution (HTML5, SilverLight, Flash, etc.). 在这些情况下,可以考虑使用另一种解决方案(HTML5,SilverLight,Flash等)。 Or you could tone down your RIA needs. 或者,您可以降低RIA的需求。

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

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