liveBook · Manning

Component-based web framework

As explained in Test Driven: Practical TDD and Acceptance TDD for Java Developers

A component-based web framework structures web applications as reusable components that encapsulate interface and behavior.

When handling every request directly means parsing parameters and coordinating behavior yourself, a component-based framework offers a higher-level approach: reusable UI components provide behavior, while the framework manages their interaction with browser requests. section 5.4 section 5.4.1

A typical component-based application divides responsibilities among:

  • UI components, implemented as regular Java classes, that provide behavior and follow a framework-managed component life cycle. section 5.4.1
  • HTML templates that lay out the components, plus configuration that maps components to placeholders, resources, and client-generated events. section 5.4.1
  • The framework, which connects browser requests and events to component instances and their methods. section 5.4.1

Because a component is often ordinary Java code, testing it can resemble testing other Java classes. Templates and framework wiring add separate concerns; some frameworks use XML configuration, while others use Java annotations. section 5.4.1 section 5.4.1

Framework examples

Apache Tapestry, Wicket, and JavaServer Faces (JSF) are examples of component-based frameworks. Wicket represents pages as Java classes, with HTML templates as the remaining non-Java artifacts apart from web.xml. section 5.4 section 5.4.1

How Test Driven: Practical TDD and Acceptance TDD for Java Developers covers it

How deep it goes
Describes component behavior, templates, configuration, and framework-managed interaction without detailing a specific implementation.
Examples
Names Apache Tapestry, Wicket, and JSF, and notes Wicket's Java page classes and HTML templates.
What you can do after
Understand how components, templates, and framework-managed browser interaction divide application responsibilities.
How it connects
Connects UI components and templates to Java classes, Java Servlets, Spring MVC, and test-driven development.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Test Driven: Practical TDD and Acceptance TDD for Java Developers. The section links point to the parts of the book it draws on.