mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-22 22:25:35 +00:00
docs: Content SEO updates (#2990)
* update yaml frontmatter format * update abstract document * update abstract factory * use the new pattern template * acyclic visitor seo * adapter seo * ambassador seo * acl seo * aaa seo * async method invocation seo * balking seo * bridge seo * builder seo * business delegate and bytecode seo * caching seo * callback seo * chain seo * update headings * circuit breaker seo * client session + collecting parameter seo * collection pipeline seo * combinator SEO * command seo * cqrs seo * commander seo * component seo * composite seo * composite entity seo * composite view seo * context object seo * converter seo * crtp seo * currying seo * dao seo * data bus seo * data locality seo * data mapper seo * dto seo * decorator seo * delegation seo * di seo * dirty flag seo * domain model seo * double buffer seo * double checked locking seo * double dispatch seo * dynamic proxy seo * event aggregator seo * event-based asynchronous seo * eda seo * event queue seo * event sourcing seo * execute around seo * extension objects seo * facade seo * factory seo * factory kit seo * factory method seo * fanout/fanin seo * feature toggle seo * filterer seo * fluent interface seo * flux seo * flyweight seo * front controller seo * function composition seo * game loop seo * gateway seo * guarded suspension seo * half-sync/half-async seo * health check seo * hexagonal seo * identity map seo * intercepting filter seo * interpreter seo * iterator seo * layers seo * lazy loading seo * leader election seo * leader/followers seo * lockable object seo * rename and add seo for marker interface * master-worker seo * mediator seo * memento seo * metadata mapping seo * microservice aggregator seo * api gw seo * microservices log aggregration seo * mvc seo * mvi seo * mvp seo * mvvm seo * monad seo * monitor seo * monostate seo * multiton seo * mute idiom seo * naked objects & notification seo * null object seo * object mother seo * object pool seo * observer seo * optimistic locking seo * page controller seo * page object seo * parameter object seo * partial response seo * pipeline seo * poison pill seo * presentation model seo * private class data seo * producer-consumer seo * promise seo * property seo * prototype seo * proxy seo * queue-based load leveling seo * reactor seo * registry seo * repository seo * RAII seo * retry seo * role object seo * saga seo * separated interface seo * serialized entity seo * serialized lob seo * servant seo * server session seo * service layer seo * service locator seo * service to worker seo * sharding seo * single table inheritance seo * singleton seo * spatial partition seo * special case seo * specification seo * state seo * step builder seo * strangler seo * strategy seo * subclass sandbox seo * table module seo * template method seo * throttling seo * tolerant reader seo * trampoline seo * transaction script seo * twin seo * type object seo * unit of work seo * update method seo * value object seo * version number seo * virtual proxy seo * visitor seo * seo enhancements * seo improvements * SEO enhancements * SEO improvements * SEO additions * SEO improvements * more SEO improvements * rename hexagonal + SEO improvements * SEO improvements * more SEO stuff * SEO improvements * SEO optimizations * SEO enhancements * enchance SEO * improve SEO * SEO improvements * update headers
This commit is contained in:
+21
-19
@@ -1,23 +1,25 @@
|
||||
---
|
||||
title: Page Controller
|
||||
title: "Page Controller Pattern in Java: Centralizing Web Page Logic for Cleaner Design"
|
||||
shortTitle: Page Controller
|
||||
description: "Explore the Page Controller design pattern in Java with detailed examples. Learn how it handles web application requests and improves architectural organization."
|
||||
categories: Architectural
|
||||
language: en
|
||||
tags:
|
||||
- API design
|
||||
- Business
|
||||
- Client-server
|
||||
- Decoupling
|
||||
- Enterprise patterns
|
||||
- Layered architecture
|
||||
- Presentation
|
||||
- Web development
|
||||
- API design
|
||||
- Business
|
||||
- Client-server
|
||||
- Decoupling
|
||||
- Enterprise patterns
|
||||
- Layered architecture
|
||||
- Presentation
|
||||
- Web development
|
||||
---
|
||||
|
||||
## Intent
|
||||
## Intent of Page Controller Design Pattern
|
||||
|
||||
The Page Controller pattern is intended to handle requests for a specific page or action within a web application, processing input, and determining the appropriate view for rendering the response.
|
||||
|
||||
## Explanation
|
||||
## Detailed Explanation of Page Controller Pattern with Real-World Examples
|
||||
|
||||
Real-world example
|
||||
|
||||
@@ -27,11 +29,11 @@ Real-world example
|
||||
|
||||
In plain words
|
||||
|
||||
> The Page Controller pattern handles requests for specific pages or actions within a web application, processing input, executing business logic, and determining the appropriate view for rendering the response.
|
||||
> The Page Controller pattern handles requests for specific pages or actions within a Java web application, processing input, executing business logic, and determining the appropriate view for rendering the response, enhancing response handling and system architecture.
|
||||
|
||||
**Programmatic Example**
|
||||
## Programmatic Example of Page Controller Pattern in Java
|
||||
|
||||
The Page Controller design pattern is a pattern used in web development where each page of a website is associated with a class or function known as a controller. The controller handles the HTTP requests for that page and determines which model and view to use. This pattern is commonly used in MVC (Model-View-Controller) architectures.
|
||||
The Page Controller design pattern is a pattern used in web development where each page of a website is associated with a class or function known as a controller. The controller handles the HTTP requests for that page and determines which model and view to use. Predominantly utilized in MVC (Model-View-No-Controller) architectures, the Java Page Controller pattern integrates seamlessly with existing enterprise frameworks.
|
||||
|
||||
In the provided code, we have an example of the Page Controller pattern implemented using Spring Boot in Java. Let's break it down:
|
||||
|
||||
@@ -119,19 +121,19 @@ public class UserView {
|
||||
|
||||
In this example, the controllers (`SignupController` and `UserController`) are the Page Controllers. They handle the HTTP requests for their respective pages and determine which model and view to use. The models (`SignupModel` and `UserModel`) hold the data for the page, and the views (`SignupView` and `UserView`) determine how that data is presented. This separation of concerns makes the code easier to manage and maintain.
|
||||
|
||||
## Applicability
|
||||
## When to Use the Page Controller Pattern in Java
|
||||
|
||||
* When developing a web application where each page or action needs specific processing.
|
||||
* When aiming to separate the request handling logic from the view rendering logic.
|
||||
* In scenarios where a clear separation of concerns between different layers (controller, view) is required.
|
||||
|
||||
## Known Uses
|
||||
## Real-World Applications of Page Controller Pattern in Java
|
||||
|
||||
* Spring MVC (Java)
|
||||
* Apache Struts
|
||||
* JSF (JavaServer Faces)
|
||||
|
||||
## Consequences
|
||||
## Benefits and Trade-offs of Page Controller Pattern
|
||||
|
||||
Benefits:
|
||||
|
||||
@@ -144,13 +146,13 @@ Trade-offs:
|
||||
* Complexity: Can add complexity to the application structure, requiring careful organization and documentation.
|
||||
* Overhead: May introduce performance overhead due to additional layers of abstraction and processing.
|
||||
|
||||
## Related Patterns
|
||||
## Related Java Design Patterns
|
||||
|
||||
* [Front Controller](https://java-design-patterns.com/patterns/front-controller/): Often used in conjunction with Page Controller to handle common pre-processing logic such as authentication and logging.
|
||||
* View Helper: Works alongside Page Controller to assist in preparing the view, often handling formatting and other presentation logic.
|
||||
* [Model-View-Controller (MVC)](https://java-design-patterns.com/patterns/model-view-controller/): Page Controller is a fundamental part of the MVC architecture, acting as the Controller.
|
||||
|
||||
## Credits
|
||||
## References and Credits
|
||||
|
||||
* [Core J2EE Patterns: Best Practices and Design Strategies](https://amzn.to/4cAbDap)
|
||||
* [Design Patterns: Elements of Reusable Object-Oriented Software](https://amzn.to/3w0pvKI)
|
||||
|
||||
Reference in New Issue
Block a user