You can recognize a classic JavaBean, divide responsibilities among Model-View-Controller, and trace a request without placing SQL or business rules in the view. Readiness: classes, servlets, JDBC repository, and HTML output.
In this outline, JavaBeans is taught as the classic component/property convention: a public class, commonly a public no-argument constructor, private properties exposed by naming-convention getters/setters, and optional serializability/events. This is not automatically the same as a Jakarta CDI managed bean, Enterprise JavaBean, or a plain domain object.
public class CourseBean implements java.io.Serializable {
private String code;
private String title;
public CourseBean() {}
public String getCode() { return code; }
public void setCode(String code) { this.code = code; }
public String getTitle() { return title; }
public void setTitle(String title) { this.title = title; }
}
flowchart LR
R[HTTP request] --> C[Controller servlet]
C --> M[Application/domain model]
M --> P[Repository]
C --> V[View or JSON serializer]
V --> S[HTTP response]
Controller reads code, validates shape, calls FindCourse, and receives found/not-found/failure. It creates a small view model and forwards to a template or serializes JSON. The view displays; it does not open a database connection. The repository queries; it does not choose an HTTP status.
A JSP-like view calls JDBC and decides whether a user may edit. Hint: which rules are presentation? Solution: move authorization/use case to controller/application service and persistence to repository; pass only the prepared result to the view.
Refactor a single servlet containing validation, SQL, HTML strings, and authorization into controller, use-case service, repository, and view/serializer. Create a CourseBean or view model only where property conventions help. Unit-test the use case without a servlet container and integration-test controller mapping.
Q1 Classic bean property for getTitle/setTitle? title. Q2 Which MVC part chooses HTTP/view flow? Controller; business result comes from model/service.
Draw and explain MVC for “submit assignment.” Include validation, authorization, transaction, upload storage, view model, and five failure paths. Rubric: boundaries 4, flow 2, failures 2, security 1, clarity 1.
MVC separates reasons to change. A bean convention helps tools discover properties, but it does not replace domain design.