DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • API Design
  • How To Learn Secure Software Development Lifecycle (SDLC)
  • Unraveling Lombok's Code Design Pitfalls: Exploring Encapsulation Issues
  • Technical Approach to Design an Extensible and Scalable Data Processing Framework

Trending

  • Leveraging FastAPI for Building Secure and High-Performance Banking APIs
  • Top 7 Best Practices DevSecOps Team Must Implement in the CI/CD Process
  • Creating a Deep vs. Shallow Copy of an Object in Java
  • The Agile Architect: Mastering Architectural Observability To Slay Technical Debt

Understanding Front Controller Design Pattern

Sandeep Bhandari user avatar by
Sandeep Bhandari
·
May. 02, 11 · Tutorial
Like (0)
Save
Tweet
Share
53.94K Views

Join the DZone community and get the full member experience.

Join For Free

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.

While reading the brief overview you may have thought about ActionServlet in Struts 1 or Dispatchers in Struts 2. Yes both of them are implementations of Front controller design pattern. But most of the developers that I have interacted to (specially the beginners) end their thought process of Front Controller at Struts only.

The Front Controller design pattern is applicable and useful for all kind of applications be it web or desktop applications and is not limited to any single programming language or framework. Before the rollout of MVC frameworks in the market, the design pattern was still in use.

The only downside was that not all application could make use of it because of the effort involved. Only the applications which had custom framework in place were using the design pattern.

So for example in case of a Java based web application, which is not using any MVC framework, all the requests would be mapped to a single servlet in web.xml file. This we know can be done by using the servlet mapping (same as we do for ActionServlet in case of Struts 1).

<web-app>    <servlet>        <servlet-name> FrontServlet</servlet-name>        <servlet-class> com.example.test.FrontServlet</servlet-class>    </servlet>    <servlet-mapping>        <servlet-name>FrontServlet<servlet-name>        <url-pattern>/*</url-pattern>    <servlet-mapping></servlet-mapping></servlet-name></servlet-name></servlet-mapping></web-app>

Once the request reached the FrontServlet, it uses some configuration files to decide the appropriate dispatcher for the request and thus forwards the request using forward mechanism.

From http://extreme-java.blogspot.com/2011/04/understanding-front-controller-design.html

 

Front controller Design

Opinions expressed by DZone contributors are their own.

Related

  • API Design
  • How To Learn Secure Software Development Lifecycle (SDLC)
  • Unraveling Lombok's Code Design Pitfalls: Exploring Encapsulation Issues
  • Technical Approach to Design an Extensible and Scalable Data Processing Framework

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: