Javatpoint Logo
Javatpoint Logo

GWT MVP

MVP (Model View Presenter) is a design pattern which allows the application developing in gwt to follow MVP architecture. MVP provides the solution of the problem of complexity for developing application. Application development is complex as many developer working on same code due to which all follow same design pattern.

Following are the description of each component:

Gwt Mvp 1
  1. Model: In this segment model consist of data only. It holds within the business object which is to be manipulated and calculated according to application need.
  2. View: It only consists of view i.e. display the data which is given by presenter. It provides reusability of view code as we can swap the new view very easily. It only deals with the HTML and CSS which also helps in separate testing.
  3. Presenter: It contains all the logic which is to be implemented in the application development. It communicates with model as well as view. It is complete distinct in operation which provide separate JUnit testing.

Implementation

Below is the code of Login application which is designed on the base of MVP.

LoginView.java

MainPageView.java

Now we build our UI component which follows the presenter that controls the behavior and interaction of the views.

LoginPresenter.java

Now we design the interface communication between view and presenter called display.

For Login View

For Main page View

Finally we implement the app controller

Now application structure looks like

Gwt Mvp 2

Output

Gwt Mvp 3
Next TopicMVP vs MVC





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA