2

I'm building a large hierarchical web application and I need some help deciding on some best practices with leveraging MVC.

The application will have tabs at the top which control a sub page, and a query pane (off to the side).

There will be two templates for query panes, each used by different sub-pages. The sub-pages will be based on the selected tab with settings derived from the query panes.

Clicking on tabs or updating the query pane will update the sub-page section without refreshing the page.

I'm a bit new to MVC and what I don't quite understand is how I can leverage MVC methodologies to help me manage the web application's state (which consists of the selected tab, query options, and other page-specific options).

Currently I'm planning on initially setting up a model which stores the client state parameters (default values, or values obtained from a DB), and using it to load the page, consisting of several partial views. When anything is changed (tab/query/etc), the view will call a corresponding controller, passing back model parameters via post (I'm assuming there's no way to store session-specific client state models on the server-side?).

My question is:

Am I doing it right? If not, what am I missing; and specifically, is there a way to store these session-specific state models server side so they don't have to be passed back to the server during every single page transaction?

4

1 に答える 1

1

必要なものがすべて理解できれば、それは SPA (Single Page Application) です。これにより、ページ全体のリロードがなく、データ トラフィックが少ない魔法のようなユーザー エクスペリエンスが提供されます。ただし、いくつかの MVVM フレームワーク (AngularJS、KnockoutJs など) と多くの JavaScript コーディングが必要です。しかし、結果は驚くべきものです。MVC でこの背後にいるのは John Papa です。彼のブログのすべてを調べれば、あなたが勝つでしょう。

ジョン・パパのブログ

その助けを願っています

于 2013-05-16T02:38:24.360 に答える