顯示具有 mvc 標籤的文章。 顯示所有文章
顯示具有 mvc 標籤的文章。 顯示所有文章

【MVC】SSH三大框架的基本介紹



MVC經常與SSH綁在一起的熱門搜尋字,SSH分別代表:
  1. Spring 
  2. Struts 
  3. Hibernate。
為何要使用MVC?是因為在使用Java撰寫Web應用程序過程中,將請求先使用Servlet(如:web.xml),可以將邏輯分開放、維護較容易等等。
而框架是指三個功能面的總和架構,包含數據(例:使用者登入及密碼)、頁面展現(login.jsp)、處理需求的場所,這也是  Model -數據、 View-頁面展示、Control-處理需求的場所的來由,而在Controller中的設計,攸關於請求跟回應,也就是在遊覽器跟伺服器之間的處理場所,各個框架在Controller使用的都是以一串URL為中心,並以參數為輔的設計,也就是在Cotroller中交互Http訊息。


【MVC】 何謂MVC?

model-view-controller(MVC)


In object-oriented programming development, model-view-controller (MVC) is the name of a methodology or design pattern for successfully and efficiently relating the user interface to underlying data models. The MVC pattern is widely used in program development with programming languages such as Java, Smalltalk, C, and C++.
在物件導向設計(面向對象程序設計,縮寫:OOP)中,是一種方法或設計模型將使用者介面成功與有效率地連結給底層資料模型,便是MVC模型。而MVC模型也大量用在於Java, Smalltalk, C, and C++等程式語言的開發中。

The MVC pattern has been heralded by many developers as a useful pattern for the reuse of object code and a pattern that allows them to significantly reduce the time it takes to develop applications with user interfaces.
許多開發者已經將MVC模型視為可重複使用目的碼(目標代碼),並能大量減少使用者界面開發應用程式的有用模式。



The model-view-controller pattern proposes three main components or objects to be used in software development:
在MVC模型當中,提出三個主要提出三個主要組建或對象被使用在軟體開發當中:

A Model , which represents the underlying, logical structure of data in a software application and the high-level class associated with it. This object model does not contain any information about the user interface.
模型,代表在軟體應用程式中數據的基礎邏輯結構,以及與其相關的高級類別。此物件模型不包含任何關於使用者介面的訊息。

A View , which is a collection of classes representing the elements in the user interface (all of the things the user can see and respond to on the screen, such as buttons, display boxes, and so forth)
視圖,代表使用者界面元素中的類別集合(使用者在螢幕上可以看到與回應的所有事情,像是按鍵、顯示框等等)

A Controller , which represents the classes connecting the model and the view, and is used to communicate between classes in the model and view.
控制器,用於類別與視圖的溝通,亦即代表一個類別連結模型與視圖。