1. Home
  2. Training Library
  3. Programming
  4. Programming Courses
  5. Using Design Patterns in Java Projects

Front Controller

Contents

keyboard_tab
Design Patterns
1
Design Patterns
PREVIEW2m 26s
2
Singleton Pattern
PREVIEW3m 13s
9
Decorator
7m 48s
10
Flyweight
9m 20s
11
Proxy
7m 36s
12
Facade
6m 5s
14
Command
11m 44s
15
Iterator
8m 24s
16
Visitor
9m 4s
17
Mediator
11m 38s
18
Memento
9m 48s
19
Observer
10m 40s
20
Strategy
8m 27s
21
State
10m 27s
22
Template
7m 56s
23
MVC
10m 27s
26
DAO
10m 27s
27

The course is part of this learning path

Start course
Overview
Difficulty
Intermediate
Duration
4h 56m
Students
22
Ratings
5/5
starstarstarstarstar
Description

This course takes an in-depth look at how to use design patterns in your Java projects. We will then run through some example questions of what you could expect from the Oracle Certified Java EE exam.

Learning Objectives

  • Understand what design patterns are
  • Learn about the myriad of design patterns that you can use in your projects

Intended Audience

This course is intended for anyone who already has basic knowledge of Java and now wants to learn about Java EE 6.

Prerequisites

Basic knowledge of Java programming.

 

Transcript

Hello dear friends. In this video, we will examine the front controller pattern. Let's begin. The front controller design pattern means that all requests that come for a resource in an application will be handled by a single handler and then dispatched to the appropriate handler for that type of request. The front controller may use other helpers to achieve the dispatching mechanism. The front controller software design pattern is listed in several pattern catalogs and related to the design of web applications. It is a controller that handles all requests for a website, which is a useful structure for web application developers to achieve flexibility and reuse without code redundancy. Front controller pattern has four participants. The controller is an entrance for users to handle requests in the system. It realizes authentication by playing the role of delegating helper or initiate contact retrieval.

Front controller is single handler for all kinds of requests coming to the application. Views are the object for which the requests are made. A view represents and displays information to the client. The view retrieves information from a model. Helpers support views by encapsulating and adapting the underlying data model for use in the display. Dispatchers can be used for navigation and managing the view output. Users will receive the next view that is determined by the dispatcher. Dispatchers are also flexible. They can be encapsulated within the controller directly or separated to another component. The dispatcher provides a static view along with the dynamic mechanism. A helper is responsible for helping a view or controller complete its processing. Thus, helpers have numerous responsibilities, including gathering data required by the view and storing this intermediate model, in which case the helper is sometimes referred to as a value bean. I think that's enough for now. Let's write some code and put this pattern into practice. Create a new project and name it FrontController.

First, we need two views. EmployeeView, ShowView. Let's add for manager, ShowView, Done. Now we need a dispatcher. First, define views. Now in constructor we will use them. Now let's define the dispatch method. A request for either of these two can come up at any point. We use the dispatcher to deal with the request, pointing to the correct view after the front controller processed the request initially. And last, we need a controller. Define dispatcher. And now we need three methods. isAuthenticUser, trackRequest. Last one will be dispatchRequest. Now we have finished coding the structure, let's use it. First, define controller. Now, send manager request and employee request. And look, for manager, we can see managerView, and for employee request, we can see the employeeView. Now, with this video we have finished studying design patterns. In the next video we will start to solve topic questions. See you in the next video.

 

About the Author
Students
433
Courses
47
Learning Paths
2

OAK Academy is made up of tech experts who have been in the sector for years and years and are deeply rooted in the tech world. They specialize in critical areas like cybersecurity, coding, IT, game development, app monetization, and mobile development.

Covered Topics