What the pattern is trying to achieve
Separate request handling from rendering by having a controller dispatch to a view after preparing the model.
Dispatcher View keeps a controller focused on request handling and model preparation while a dedicated view handles rendering.
Not every order screen needs a full orchestration-heavy workflow. Many just need controller-prepared data rendered clearly. Dispatcher View keeps that split clean.
Separate request handling from rendering by having a controller dispatch to a view after preparing the model.
Templates need controller-prepared data, but you do not want rendering logic mixed into the controller or business logic mixed into the template.
Use a controller to gather data and dispatch to a dedicated rendering view.
This is still a common pattern in Spring MVC and similar controller-template stacks.
package org.javaomnibus.ecommerce.web;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public final class AccountController {
private final AccountQueryService accountQueryService;
public AccountController(AccountQueryService accountQueryService) {
this.accountQueryService = accountQueryService;
}
@GetMapping("/account")
public String account(Model model) {
model.addAttribute("profile", accountQueryService.loadProfile());
model.addAttribute("orders", accountQueryService.loadRecentOrders());
return "account";
}
}
Dispatcher View is lighter than Service to Worker. Use it when the controller mainly gathers data and forwards, not when substantial business processing occurs.