{"id":2106,"date":"2016-01-19T15:19:46","date_gmt":"2016-01-19T07:19:46","guid":{"rendered":"http:\/\/blog2.tibame.com\/?p=2106"},"modified":"2022-04-08T18:18:49","modified_gmt":"2022-04-08T10:18:49","slug":"mvc%e3%80%81mvp%e3%80%81mvvm%e3%80%81mvw%e8%aa%b0%e5%be%97%e5%a4%a9%e4%b8%8b-mvc%e5%82%b3-2","status":"publish","type":"post","link":"https:\/\/blog.tibame.com\/?p=2106","title":{"rendered":"MVC\u3001MVP\u3001MVVM\u3001MVW\u8ab0\u5f97\u5929\u4e0b-MVC\u50b3"},"content":{"rendered":"<p>POSTED BY: \u674e\u4fca\u9f8d<\/p>\n<h3>\u8edf\u9ad4\u67b6\u69cb\u662f\u751a\u9ebc<\/h3>\n<p>\u4e00\u500b\u8edf\u9ad4\u6700\u6838\u5fc3\u7684\u662f\u751a\u9ebc\uff1f\u7576\u7136\u5c31\u662f\u7a0b\u5f0f\u78bc\uff0c\u6bcf\u500b\u5de5\u7a0b\u5e2b\u65e5\u65e5\u591c\u591c\u7684\u5fc3\u8840\u7d50\u6676\uff0c\u53ef\u662f\u9f90\u5927\u7684\u8edf\u9ad4\u6bcf\u500b\u90fd\u6709\u4e0a\u5343\u884c\u7a0b\u5f0f\u78bc\u5982\u6b64\u7684\u591a\uff0c\u5728\u958b\u767c\u4e0a\u8a72\u5982\u4f55\u5206\u5de5\uff1f\u56e0\u6b64\u6709\u8a31\u591a\u5de5\u7a0b\u5e2b\u63d0\u51fa\u5404\u7a2e\u8edf\u9ad4\u67b6\u69cb\u3001\u8a2d\u8a08\u6a21\u5f0f\uff0c\u597d\u5e6b\u52a9\u5927\u5bb6\u80fd\u5920\u66f4\u597d\u7684\u5206\u5de5\u4ee5\u53ca\u958b\u767c\u8edf\u9ad4\u3002\u5c31\u6b64MVC\u56e0\u61c9\u800c\u751f\u4f46\u662f\u96a8\u8457\u6280\u8853\u7684\u63a8\u9673\u51fa\u65b0\uff0c\u4ee5\u53ca3C\u7522\u54c1\u7684\u4e16\u4ee3\u66f4\u65b0\uff0c\u57fa\u672c\u7684MVC\u4e5f\u4e0d\u80fd\u9069\u61c9\uff0cMVP\u3001MVVM\u2026\u5404\u7a2e\u65b0\u7684\u6a21\u5f0f\u4e00\u4e00\u554f\u4e16\uff0c\u5230\u5e95<br \/>\n\u672a\u4f86\u6703\u662f\u8ab0\u57f7\u638c\u725b\u8033\u5462\uff1f\u9084\u662f\u6c5f\u5c71\u4ee3\u6709\u624d\u4eba\u51fa\uff1f<!--more--><\/p>\n<h4><strong>\u2023MVC<\/strong><\/h4>\n<h5>\u5148\u5f9eMVC\u958b\u59cb\uff0cMVC\u7c21\u55ae\u4f86\u8aaa\u5c31\u662f\u5c07\u7cfb\u7d71\u5206\u6210Model(\u6a21\u578b)\u3001View(\u8996\u5716)\u548cController(\u63a7\u5236\u5668)\u4e09\u500b\u90e8\u5206\u3002<\/h5>\n<ol>\n<li><strong> Model(\u6a21\u578b)<\/strong>:\u63a5\u53d7Controller\u7684\u8acb\u6c42\uff0c\u8ca0\u8cac\u8655\u7406\u5546\u696d\u908f\u8f2f\uff0c\u8ca0\u8cac\u8cc7\u6599\u8655\u7406\u908f\u8f2f\uff0c\u5728J2EE\u67b6\u69cb\u4e0b\u70baJaveBean\u3002<\/li>\n<li><strong>View(\u8996\u5716)<\/strong>\uff1a\u63a5\u53d7Controller\u7684\u8acb\u6c42\uff0c\u8ca0\u8cac\u986f\u793a\u756b\u9762\uff0c\u6703\u63a5\u6536Controller\u5f9eModel\u53d6\u51fa\u7684\u8cc7\u6599\u6216\u8005\u662f\u7d93\u904e\u904b\u7b97\u5f8c\u7684\u7d50\u679c\uff0c\u6839\u64da\u9700\u6c42\u5448\u73fe\u6240\u9700\u8981\u7684\u756b\u9762\uff0c\u5728J2EE\u67b6\u69cb\u4e0b\u70baJSP\u3002<\/li>\n<li><strong>Controller(\u63a7\u5236\u5668)<\/strong>\uff1a\u63a5\u53d7\u4f7f\u7528\u8005\u7684\u8acb\u6c42\uff0c\u5f9e\u4e2d\u53d6\u5f97\u8acb\u6c42\u53c3\u6578\u3001\u9a57\u8b49\u53c3\u6578\uff0c\u8f49\u767c\u8acb\u6c42\u7d66Model\u6216\u8005\u662fView\uff0c\u5728J2EE\u67b6\u69cb\u4e0b\u70baServlet\u6216\u8005\u662fJSP\u3002<\/li>\n<\/ol>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-2075 size-full\" src=\"https:\/\/blog.wiedu.tw\/wp-content\/uploads\/2016\/01\/model2architecture.jpg\" alt=\"model2architecture\" width=\"578\" height=\"269\" srcset=\"https:\/\/blog.tibame.com\/wp-content\/uploads\/2016\/01\/model2architecture.jpg 578w, https:\/\/blog.tibame.com\/wp-content\/uploads\/2016\/01\/model2architecture-300x140.jpg 300w\" sizes=\"(max-width: 578px) 100vw, 578px\" \/><\/p>\n<h6 style=\"color: #b7b7b7; font-weight: 100; text-align: right;\">\u5716\u7247\u4f86\u6e90\uff1ahttps:\/\/sites.google.com\/site\/sureshdevang\/jsp-architecture<\/h6>\n<p>\u4e0a\u5716\u662f\u7576\u4f7f\u7528\u8005\u767c\u51fa\u8acb\u6c42\uff0cMVC\u7684\u6d41\u7a0b\u67b6\u69cb\u70ba\uff0c\u7576Controller\u63a5\u53d7\u5230\u8acb\u6c42\u6703\u5148\u53d6\u5f97\u53c3\u6578\u4e26\u9a57\u8b49\uff0c\u6703\u6839\u64da\u9700\u6c42\u5c07\u6b64\u8cc7\u6599\u8f49\u7d66Model\u9032\u884c\u5546\u696d\u908f\u8f2f\u8655\u7406\uff0cModel\u8207\u8cc7\u6599\u5eab\u5efa\u7acb\u9023\u7dda\uff0c\u9032\u884c\u5546\u696d\u908f\u8f2f\u7684\u8cc7\u6599\u8655\u7406\uff0c\u8655\u7406\u5b8c\u6210\u6703\u5c07\u7d50\u679c\u50b3\u56de\u7d66Controller\uff0cController\u6703\u6839\u64da\u9700\u6c42\u5c07Model\u7684\u8655\u7406\u7d50\u679c\u50b3\u7d66View\uff0cView\u5728\u6839\u64da\u9700\u6c42\u56de\u50b3\u6240\u9700\u8981\u7684\u756b\u9762\u7d66\u4f7f\u7528\u8005\u3002<\/p>\n<h4><strong>\u76ee\u524d\u4e3b\u6d41\u7684Web MVC<\/strong><\/h4>\n<p>\u96a8\u8457\u6280\u8853\u4e0d\u65b7\u7684\u6f14\u9032\uff0cJavaScript\u3001DOM\u3001Ajax\u61c9\u7528\u65e5\u6f38\u5ee3\u6cdb\uff0c\u751a\u81f3HTML5\u65b0API\u7684\u63a8\u6ce2\u52a9\u703e\uff0c\u4ee5\u53ca\u4f3a\u670d\u7aef\u975e\u540c\u6b65\u8655\u7406\u6280\u8853\u7684\u9032\u6b65\uff0c\u5373\u4f7f\u4f7f\u7528\u50b3\u7d71\u7684\u6301\u7e8c\u8acb\u6c42\u8a62\u554f\u65b9\u5f0f\uff0c\u5df2\u4e0d\u518d\u9700\u8981\u91cd\u6e05\uff08Refresh\uff09\u6574\u500b\u9801\u9762\uff0c\u53ef\u5229\u7528Ajax\u5728\u80cc\u666f\u53d6\u5f97Model\u7684\u8cc7\u6599\uff0c\u800c\u5f8c\u7528JavaScript\u66f4\u65b0\u756b\u9762\u4e0a\u76f8\u61c9\u7684\u90e8\u5206\u5373\u53ef\u3002<br \/>\n\u73fe\u5728\u662f\u700f\u89bd\u5668\u4ea6\u53ef\u6709\u81ea\u6210\u4e00\u9ad4\u7684MVC\u61c9\u7528\u7a0b\u5f0f\uff0c\u7531HTML\u3001DOM\u3001CSS\u4f5c\u70baView\u7684\u5be6\u73fe\uff0cJavaScript\u7528\u4ee5\u5be6\u73feController\u8207Model\uff0c\u5c31\u80fd\u5728\u700f\u89bd\u5668\u4e2d\u5be6\u73fe\u50b3\u7d71MVC\u6a21\u5f0f\u61c9\u6709\u6d41\u7a0b\uff0c\u700f\u89bd\u5668\u4e2dJavaScript\u64b0\u5beb\u7684Model\uff0c\u53ef\u5c07\u4f3a\u670d\u7aef\u6bd4\u64ec\u70ba\u8cc7\u6599\u5eab\uff0c\u5411\u4f3a\u670d\u7aef\u53d6\u5f97\u8cc7\u6599\uff0c\u5c31\u50cf\u5c0d\u8cc7\u6599\u5eab\u67e5\u8a62\uff0cAjax\u662f\u8207\u4f3a\u670d\u7aef\u6e9d\u901a\u7684\u6a5f\u5236\uff0c\u4f3a\u670d\u7aef\u50b3\u56de\u7684\u8cc7\u6599\uff0c\u76ee\u524d\u4e3b\u6d41\u70baXML\u548cJSON\u9019\u5169\u7a2e\u8cc7\u6599\u683c\u5f0f\u4e26\u4e14\u6703\u53bb\u5be6\u4f5cRestful\u67b6\u69cb\uff0c\u9019\u7a2e\u8a2d\u8a08\u6a21\u5f0f\u884d\u751f\u4e86MVW\u7684\u958b\u982d\uff0c\u4e5f\u958b\u555f\u4e86\u524d\u7aef\u6846\u67b6\u7684\u7a7a\u524d\u76db\u6cc1\u3002<\/p>\n<h4><strong>MVC\u512a\u9ede<\/strong><\/h4>\n<p>\u7531\u65bcMVC\u5f88\u597d\u7684\u5206\u96e2\u4e86View\u548cModel\uff0c\u6240\u4ee5\u5b83\u5177\u6709\u4ee5\u4e0b\u512a\u9ede<\/p>\n<ol>\n<li>\u7a0b\u5f0f\u9593\u76f8\u4f9d\u6027\u4f4e\u3002<\/li>\n<li>\u958b\u767c\u901f\u5ea6\u5feb\u3002<\/li>\n<li>\u53ef\u7dad\u8b77\u6027\u9ad8\u3002<\/li>\n<\/ol>\n<h4><strong>MVC\u7f3a\u9ede<\/strong><\/h4>\n<ol>\n<li>\u7a0b\u5f0f\u9593\u76f8\u4f9d\u6027\u4f4e\u3002<\/li>\n<li>\u4e0d\u9069\u5408\u5c0f\u578b\uff0c\u4e2d\u7b49\u898f\u6a21\u7684\u61c9\u7528\u7a0b\u5f0f<\/li>\n<li>\u82b1\u8cbb\u6642\u9593\u904e\u9577\u3002<\/li>\n<\/ol>\n<p>\u4e0b\u4e00\u7bc7\u6211\u5011\u5c07\u6703\u63a2\u8a0eMVP\u5728JavaScript\u4e0a\u7684\u61c9\u7528\u3002<\/p>\n<p>Tibame\u5b78\u7fd2\u7db2\u76f8\u95dc\u8ab2\u7a0b<\/p>\n<div class=\"pcrstb-wrap\"><table border=\"1\" width=\"60%\">\n<tbody>\n<tr>\n<td style=\"border: #E0E0E0 1px solid; background-color: white;\"><a href=\"http:\/\/www.tibame.com\/q?pg=programs_all&amp;tg=ProgramAll-Welcome&amp;cx=22.20000&amp;programId=30000000243\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncentert size-medium wp-image-2080\" src=\"https:\/\/blog.wiedu.tw\/wp-content\/uploads\/2016\/01\/JSP_\u5b78\u7a0b\u5716-300x150.jpg\" alt=\"JSP_\u5b78\u7a0b\u5716\" width=\"300\" srcset=\"https:\/\/blog.tibame.com\/wp-content\/uploads\/2016\/01\/JSP_\u5b78\u7a0b\u5716-300x150.jpg 300w, https:\/\/blog.tibame.com\/wp-content\/uploads\/2016\/01\/JSP_\u5b78\u7a0b\u5716-768x384.jpg 768w, https:\/\/blog.tibame.com\/wp-content\/uploads\/2016\/01\/JSP_\u5b78\u7a0b\u5716.jpg 833w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Java Web\u7a0b\u5f0f\u8a2d\u8a08\u5e2b<\/p>\n<p>&nbsp;<\/td>\n<td style=\"border: #E0E0E0 1px solid; background-color: white;\"><a href=\"http:\/\/www.tibame.com\/q?pg=programs_all&amp;tg=ProgramAll-Welcome&amp;cx=22.20000&amp;programId=30000000243\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-2081\" src=\"https:\/\/blog.wiedu.tw\/wp-content\/uploads\/2016\/01\/TibaMe-track_J2EE\u5de5\u7a0b\u5e2b.png\" alt=\"TibaMe-track_J2EE\u5de5\u7a0b\u5e2b\" width=\"300\" \/><\/a><\/p>\n<p>Struts 2\u6280\u8853\u5de5\u7a0b\u5e2b<\/p>\n<p>&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/div>\n","protected":false},"excerpt":{"rendered":"<p>POSTED BY: \u674e\u4fca\u9f8d \u8edf\u9ad4\u67b6\u69cb\u662f\u751a\u9ebc \u4e00&hellip;<\/p>\n","protected":false},"author":19,"featured_media":2070,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[480,173,1539],"tags":[665,666,667],"class_list":["post-2106","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology","category-173","category-1539","tag-mvc","tag-mvp","tag-mvw"],"aioseo_notices":[],"views":3498,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.tibame.com\/index.php?rest_route=\/wp\/v2\/posts\/2106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.tibame.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.tibame.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.tibame.com\/index.php?rest_route=\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.tibame.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2106"}],"version-history":[{"count":4,"href":"https:\/\/blog.tibame.com\/index.php?rest_route=\/wp\/v2\/posts\/2106\/revisions"}],"predecessor-version":[{"id":13907,"href":"https:\/\/blog.tibame.com\/index.php?rest_route=\/wp\/v2\/posts\/2106\/revisions\/13907"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.tibame.com\/index.php?rest_route=\/wp\/v2\/media\/2070"}],"wp:attachment":[{"href":"https:\/\/blog.tibame.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.tibame.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.tibame.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}