The Login form with Model View Presenter
In this recipe, we will implement a login form using the Model View Presenter (MP) pattern.
We want to introduce a Vaadin application applying the MVP pattern in this recipe and therefore the login form will be of low complexity. The login form will consist of two text fields and a login
button. When a user clicks on the login
button, the request is forwarded to the presenter. The presenter calls the service in order to fetch a user from the database. Then the presenter notifies the user interface about the success or the failure.
Note
Basic information about Model View Presenter pattern can be found on Wikipedia at http://en.wikipedia.org/wiki/Model-view-presenter.
More detailed description of MVP pattern is available at http://martinfowler.com/eaaDev/ModelViewPresenter.html.
Getting ready
Before we start, we create a simple class diagram. Start reading the class diagram from the MyVaadinUI
class. MyVaadinUI
creates all the three MVP layers; view, presenter...