Помни, Товарищ!
Использование единого URL для различных поведенческих моделей одной формы в MVC (URL то один, но в зависимости от типа HTTP запроса - вызываются различные методы контроллера и различные вьюшки) избавляет от пробелем с закладками на данную страницу и отпроблемы повторной пересылки редактируемой формы.
Оригинал
You might ask – why are we using a single URL and differentiating its behavior via the HTTP verb? Why not just have two separate URLs to handle loading and saving edit changes? For example: /Dinners/Edit/[id] to display the initial form and /Dinners/Save/[id] to handle the form post to save it?
The downside with publishing two separate URLs is that in cases where we post to /Dinners/Save/2, and then need to redisplay the HTML form because of an input error, the end-user will end up having the /Dinners/Save/2 URL in their browser’s address bar (since that was the URL the form posted to). If the end-user bookmarks this redisplayed page to their browser favorites list, or copy/pastes the URL and emails it to a friend, they will end up saving a URL that won’t work in the future (since that URL depends on post values).
By exposing a single URL (like: /Dinners/Edit/[id]) and differentiating the processing of it by HTTP verb, it is safe for end-users to bookmark the edit page and/or send the URL to others.
Источник
Professional ASP.NET MVC 1.0
By Rob Conery, Scott Hanselman, Phil Haack, Scott Guthrie
Комментариев нет:
Отправить комментарий