# apache/struts-examples architecture

> Architecture diagram of the GitHub repository apache/struts-examples, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/apache/struts-examples
- Repository: https://github.com/apache/struts-examples

## Overview

This repository is a collection of independent Apache Struts tutorial applications, not one integrated product. Users explore examples demonstrating framework features; each application’s request handling and result depend on its own Struts configuration and web pages, which are not shown here. The graph highlights the CRUD example’s service/DAO layer and the custom expression-cache factory, plus representative tutorial feature areas from the tree. Source excerpts are limited, so most example-to-example or UI-to-action relationships are intentionally not asserted.

Main entry points: [`crud/src/main/java/org/apache/struts/crud/service/DefaultPersonService.java`](https://github.com/apache/struts-examples/blob/main/crud/src/main/java/org/apache/struts/crud/service/DefaultPersonService.java) (Person service), [`expression-cache/src/main/java/org/apache/struts/cache/CustomOECFactory.java`](https://github.com/apache/struts-examples/blob/main/expression-cache/src/main/java/org/apache/struts/cache/CustomOECFactory.java) (Cache factory), [`crud/src/main/java/org/apache/struts/crud/dao/MemoryPersonDao.java`](https://github.com/apache/struts-examples/blob/main/crud/src/main/java/org/apache/struts/crud/dao/MemoryPersonDao.java) (Person DAO), [`crud/src/main/java/org/apache/struts/crud/dao/MemoryPersonSupportDao.java`](https://github.com/apache/struts-examples/blob/main/crud/src/main/java/org/apache/struts/crud/dao/MemoryPersonSupportDao.java) (Lookup DAO)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_crud["CRUD Example"]
  node_person_action["Person actions<br/>[PersonAction.java]"]
  node_person_service["Person service"]
  node_person_dao[("Person DAO")]
  node_support_dao[("Lookup DAO")]
  node_person_model["Person model<br/>[Person.java]"]
  node_country_model["Country model<br/>[Country.java]"]
end

subgraph group_framework["Framework Features"]
  node_cache_factory["Cache factory"]
  node_expression_cache["Expression cache<br/>[CustomOEC.java]"]
  node_lru_cache["LRU cache<br/>[CustomOELRUC.java]"]
  node_text_provider["Localized text"]
  node_unknown_handler["Unknown handler"]
end

subgraph group_forms["Forms And Validation"]
  node_edit_action["Edit action<br/>[EditAction.java]"]
  node_edit_service["Edit service"]
  node_edit_model["Edit model<br/>[Person.java]"]
  node_register_action["Registration action<br/>[Register.java]"]
  node_register_model["Registration model<br/>[Person.java]"]
end

subgraph group_web["Web Examples"]
  node_angular_app["Angular app<br/>[app.js]"]
  node_orders_ui["Order controllers"]
  node_data_service["Data service<br/>[DataService.js]"]
  node_hello_action["Hello-world action"]
  node_message_store["Message store<br/>[MessageStore.java]"]
  node_chain_a["Chained action A<br/>[ActionA.java]"]
  node_chain_b["Chained action B<br/>[ActionB.java]"]
end

node_user(("Tutorial user"))

node_person_service -->|"delegates CRUD"| node_person_dao
node_person_service -->|"gets lookups"| node_support_dao
node_cache_factory -->|"creates cache"| node_expression_cache
node_cache_factory -->|"creates cache"| node_lru_cache

click node_person_action "https://github.com/apache/struts-examples/blob/main/crud/src/main/java/org/apache/struts/crud/action/PersonAction.java"
click node_person_service "https://github.com/apache/struts-examples/blob/main/crud/src/main/java/org/apache/struts/crud/service/DefaultPersonService.java"
click node_person_dao "https://github.com/apache/struts-examples/blob/main/crud/src/main/java/org/apache/struts/crud/dao/MemoryPersonDao.java"
click node_support_dao "https://github.com/apache/struts-examples/blob/main/crud/src/main/java/org/apache/struts/crud/dao/MemoryPersonSupportDao.java"
click node_person_model "https://github.com/apache/struts-examples/blob/main/crud/src/main/java/org/apache/struts/crud/model/Person.java"
click node_country_model "https://github.com/apache/struts-examples/blob/main/crud/src/main/java/org/apache/struts/crud/model/Country.java"
click node_cache_factory "https://github.com/apache/struts-examples/blob/main/expression-cache/src/main/java/org/apache/struts/cache/CustomOECFactory.java"
click node_expression_cache "https://github.com/apache/struts-examples/blob/main/expression-cache/src/main/java/org/apache/struts/cache/CustomOEC.java"
click node_lru_cache "https://github.com/apache/struts-examples/blob/main/expression-cache/src/main/java/org/apache/struts/cache/CustomOELRUC.java"
click node_text_provider "https://github.com/apache/struts-examples/blob/main/text-provider/src/main/java/org/apache/struts_example/WildcardLocalizedTextProvider.java"
click node_unknown_handler "https://github.com/apache/struts-examples/blob/main/unknown-handler/src/main/java/org/apache/strutsexamples/web/TilesUnknownHandler.java"
click node_edit_action "https://github.com/apache/struts-examples/blob/main/bean-validation/src/main/java/org/apache/struts/edit/action/EditAction.java"
click node_edit_service "https://github.com/apache/struts-examples/blob/main/bean-validation/src/main/java/org/apache/struts/edit/service/EditServiceInMemory.java"
click node_edit_model "https://github.com/apache/struts-examples/blob/main/bean-validation/src/main/java/org/apache/struts/edit/model/Person.java"
click node_register_action "https://github.com/apache/struts-examples/blob/main/form-processing/src/main/java/org/apache/struts/register/action/Register.java"
click node_register_model "https://github.com/apache/struts-examples/blob/main/form-processing/src/main/java/org/apache/struts/register/model/Person.java"
click node_angular_app "https://github.com/apache/struts-examples/blob/main/rest-angular/src/main/webapp/js/app.js"
click node_orders_ui "https://github.com/apache/struts-examples/blob/main/rest-angular/src/main/webapp/js/controllers/OrdersController.js"
click node_data_service "https://github.com/apache/struts-examples/blob/main/rest-angular/src/main/webapp/js/services/DataService.js"
click node_hello_action "https://github.com/apache/struts-examples/blob/main/helloworld/src/main/java/org/apache/struts/helloworld/action/HelloWorldAction.java"
click node_message_store "https://github.com/apache/struts-examples/blob/main/helloworld/src/main/java/org/apache/struts/helloworld/model/MessageStore.java"
click node_chain_a "https://github.com/apache/struts-examples/blob/main/action-chaining/src/main/java/org/apache/struts_examples/ActionA.java"
click node_chain_b "https://github.com/apache/struts-examples/blob/main/action-chaining/src/main/java/org/apache/struts_examples/ActionB.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_person_action,node_person_service,node_person_dao,node_support_dao,node_person_model,node_country_model,node_user toneBlue
class node_cache_factory,node_expression_cache,node_lru_cache,node_text_provider,node_unknown_handler toneAmber
class node_edit_action,node_edit_service,node_edit_model,node_register_action,node_register_model toneMint
class node_angular_app,node_orders_ui,node_data_service,node_hello_action,node_message_store,node_chain_a,node_chain_b toneRose
```

## Components

### CRUD Example

- [Person actions](https://github.com/apache/struts-examples/blob/main/crud/src/main/java/org/apache/struts/crud/action/PersonAction.java): `crud/src/main/java/org/apache/struts/crud/action/PersonAction.java`
- [Person service](https://github.com/apache/struts-examples/blob/main/crud/src/main/java/org/apache/struts/crud/service/DefaultPersonService.java): `crud/src/main/java/org/apache/struts/crud/service/DefaultPersonService.java`
- [Person DAO](https://github.com/apache/struts-examples/blob/main/crud/src/main/java/org/apache/struts/crud/dao/MemoryPersonDao.java): `crud/src/main/java/org/apache/struts/crud/dao/MemoryPersonDao.java`
- [Lookup DAO](https://github.com/apache/struts-examples/blob/main/crud/src/main/java/org/apache/struts/crud/dao/MemoryPersonSupportDao.java): `crud/src/main/java/org/apache/struts/crud/dao/MemoryPersonSupportDao.java`
- [Person model](https://github.com/apache/struts-examples/blob/main/crud/src/main/java/org/apache/struts/crud/model/Person.java): `crud/src/main/java/org/apache/struts/crud/model/Person.java`
- [Country model](https://github.com/apache/struts-examples/blob/main/crud/src/main/java/org/apache/struts/crud/model/Country.java): `crud/src/main/java/org/apache/struts/crud/model/Country.java`

### Framework Features

- [Cache factory](https://github.com/apache/struts-examples/blob/main/expression-cache/src/main/java/org/apache/struts/cache/CustomOECFactory.java): `expression-cache/src/main/java/org/apache/struts/cache/CustomOECFactory.java`
- [Expression cache](https://github.com/apache/struts-examples/blob/main/expression-cache/src/main/java/org/apache/struts/cache/CustomOEC.java): `expression-cache/src/main/java/org/apache/struts/cache/CustomOEC.java`
- [LRU cache](https://github.com/apache/struts-examples/blob/main/expression-cache/src/main/java/org/apache/struts/cache/CustomOELRUC.java): `expression-cache/src/main/java/org/apache/struts/cache/CustomOELRUC.java`
- [Localized text](https://github.com/apache/struts-examples/blob/main/text-provider/src/main/java/org/apache/struts_example/WildcardLocalizedTextProvider.java): `text-provider/src/main/java/org/apache/struts_example/WildcardLocalizedTextProvider.java`
- [Unknown handler](https://github.com/apache/struts-examples/blob/main/unknown-handler/src/main/java/org/apache/strutsexamples/web/TilesUnknownHandler.java): `unknown-handler/src/main/java/org/apache/strutsexamples/web/TilesUnknownHandler.java`

### Forms And Validation

- [Edit action](https://github.com/apache/struts-examples/blob/main/bean-validation/src/main/java/org/apache/struts/edit/action/EditAction.java): `bean-validation/src/main/java/org/apache/struts/edit/action/EditAction.java`
- [Edit service](https://github.com/apache/struts-examples/blob/main/bean-validation/src/main/java/org/apache/struts/edit/service/EditServiceInMemory.java): `bean-validation/src/main/java/org/apache/struts/edit/service/EditServiceInMemory.java`
- [Edit model](https://github.com/apache/struts-examples/blob/main/bean-validation/src/main/java/org/apache/struts/edit/model/Person.java): `bean-validation/src/main/java/org/apache/struts/edit/model/Person.java`
- [Registration action](https://github.com/apache/struts-examples/blob/main/form-processing/src/main/java/org/apache/struts/register/action/Register.java): `form-processing/src/main/java/org/apache/struts/register/action/Register.java`
- [Registration model](https://github.com/apache/struts-examples/blob/main/form-processing/src/main/java/org/apache/struts/register/model/Person.java): `form-processing/src/main/java/org/apache/struts/register/model/Person.java`

### Web Examples

- [Angular app](https://github.com/apache/struts-examples/blob/main/rest-angular/src/main/webapp/js/app.js): `rest-angular/src/main/webapp/js/app.js`
- [Order controllers](https://github.com/apache/struts-examples/blob/main/rest-angular/src/main/webapp/js/controllers/OrdersController.js): `rest-angular/src/main/webapp/js/controllers/OrdersController.js`
- [Data service](https://github.com/apache/struts-examples/blob/main/rest-angular/src/main/webapp/js/services/DataService.js): `rest-angular/src/main/webapp/js/services/DataService.js`
- [Hello-world action](https://github.com/apache/struts-examples/blob/main/helloworld/src/main/java/org/apache/struts/helloworld/action/HelloWorldAction.java): `helloworld/src/main/java/org/apache/struts/helloworld/action/HelloWorldAction.java`
- [Message store](https://github.com/apache/struts-examples/blob/main/helloworld/src/main/java/org/apache/struts/helloworld/model/MessageStore.java): `helloworld/src/main/java/org/apache/struts/helloworld/model/MessageStore.java`
- [Chained action A](https://github.com/apache/struts-examples/blob/main/action-chaining/src/main/java/org/apache/struts_examples/ActionA.java): `action-chaining/src/main/java/org/apache/struts_examples/ActionA.java`
- [Chained action B](https://github.com/apache/struts-examples/blob/main/action-chaining/src/main/java/org/apache/struts_examples/ActionB.java): `action-chaining/src/main/java/org/apache/struts_examples/ActionB.java`

### Other components

- **Tutorial user**

## Connections

- Person service → Person DAO: delegates CRUD (evidence: `crud/src/main/java/org/apache/struts/crud/service/DefaultPersonService.java`)
- Person service → Lookup DAO: gets lookups (evidence: `crud/src/main/java/org/apache/struts/crud/service/DefaultPersonService.java`)
- Cache factory → Expression cache: creates cache (evidence: `expression-cache/src/main/java/org/apache/struts/cache/CustomOECFactory.java`)
- Cache factory → LRU cache: creates cache (evidence: `expression-cache/src/main/java/org/apache/struts/cache/CustomOECFactory.java`)
