# Getting Started

## What This Project Does

This is a **Fujitsu Futurity** web application (module `koptWebA`) built on the Java EE stack with JavaServer Faces (JSF) for the presentation layer. It is a Japanese-market web system that processes requests through a servlet filter chain, routes them via a JSF FacesServlet controller, and renders JSP-based views. The project follows a classic MVC pattern with managed beans holding view state and dedicated logic classes handling business operations.

## Recommended Reading Order

Read the wiki pages in this order:

1. **Architecture Overview** — the high-level system design and technology stack
2. **Request Flow** — how an HTTP request travels through the filter, controller, and view layers
3. **Deployment Guide** — how to package and deploy `koptWebA` to an application server
4. **Module Reference** — detailed API and class documentation for each package

## Key Entry Points

Start with these classes to understand how requests enter and flow through the application:

- **`X33JVRequestEncodingSjisFilter`** — `src/java/com/fujitsu/futurity/web/x33/filter/X33JVRequestEncodingSjisFilter.java` — The servlet filter that sets request encoding (SJIS for Japanese character support). This is the first point of contact for every incoming HTTP request.
- **`FacesServlet`** — `src/java/javax/faces/webapp/FacesServlet.java` — The JSF front controller defined in `web-full.xml`. It dispatches requests to the appropriate managed beans and view pages.
- **`X33AppContextListener`** — `src/java/com/fujitsu/futurity/web/x33/listener/X33AppContextListener.java` — The servlet context listener that performs application startup initialization.
- **`ACA001SFBean`** — `src/java/eo/web/webview/ACA001SF/ACA001SFBean.java` — A JSF managed bean that holds view state (e.g., form input values) for a screen.
- **`ACA001SFLogic`** — `src/java/eo/web/webview/ACA001SF/ACA001SFLogic.java` — The logic class that encapsulates business rules for the ACA001 screen flow.
- **`FULL_ACA001010PJP.jsp`** — `koptWebA/WebContent/wsd/ns/jpn/pc/FULL_ACA001010PJP.jsp` — A representative JSP view page that instantiates beans and renders HTML output.

### Request Flow

```mermaid
flowchart TD
    Client["Web Browser"] -->|HTTP Request| Filter["X33JVRequestEncodingSjisFilter<br/>Character encoding"]
    Filter -->|Forwarded Request| Faces["FacesServlet<br/>JSF Controller"]
    Faces -->|Managed Bean| Bean["ACA001SFBean<br/>View state"]
    Faces -->|Business Call| Logic["ACA001SFLogic<br/>Business logic"]
    Bean -->|Render| JSP["FULL_ACA001010PJP.jsp<br/>View page"]
    JSP -->|HTML Response| Client
```

## Project Structure

```
full-fixture-codebase/
├── koptWebA/
│   └── WebContent/                    # Web application root (deployable WAR content)
│       ├── WEB-INF/
│       │   └── web-full.xml           # Servlet, filter, and listener declarations
│       └── wsd/ns/jpn/pc/             # JSP view pages (Japanese PC screens)
│           └── FULL_ACA001010PJP.jsp
├── src/
│   ├── java/                          # Java source code
│   │   ├── com/fujitsu/futurity/web/x33/
│   │   │   ├── filter/                # Servlet filters
│   │   │   │   └── X33JVRequestEncodingSjisFilter.java
│   │   │   └── listener/              # Servlet context listeners
│   │   │       └── X33AppContextListener.java
│   │   ├── eo/web/webview/ACA001SF/   # Screen-specific managed beans and logic
│   │   │   ├── ACA001SFBean.java
│   │   │   └── ACA001SFLogic.java
│   │   └── javax/faces/webapp/        # JSF FacesServlet (stub/dependency)
│   │       └── FacesServlet.java
│   └── futurity-app/webA/env/view/def # View definition configuration
│       └── WEBGAMEN_FULL_ACA001.xml
```

- **`koptWebA/WebContent/`** — The web application archive (WAR) content. This directory is packaged into the deployable `WAR` file.
- **`src/java/com/fujitsu/futurity/web/x33/`** — The shared X33 framework layer. Contains cross-cutting components like filters and listeners used across all screens.
- **`src/java/eo/web/webview/`** — Screen-specific code organized by screen ID (`ACA001SF` in this example). Each screen has a `Bean` class for view state and a `Logic` class for business rules.
- **`src/futurity-app/webA/env/view/def/`** — View definition XML files that map screen IDs to their corresponding JSP pages and controller settings.

## Configuration

### `web-full.xml`

The primary deployment descriptor at `koptWebA/WebContent/WEB-INF/web-full.xml` declares:

| Element | Purpose |
|---------|---------|
| `<filter>` | Registers `X33JVRequestEncodingSjisFilter` for character encoding on all incoming requests |
| `<servlet>` | Registers `FacesServlet` as the JSF front controller, routing JSF requests to the FacesServlet class |

All JSF-managed pages are served through `FacesServlet` by default. The filter intercepts every request before it reaches the JSF controller, ensuring Japanese characters (SJIS/Shift_JIS encoding) are handled correctly.

### View Definition Files

XML files under `src/futurity-app/webA/env/view/def/` (e.g., `WEBGAMEN_FULL_ACA001.xml`) define the mapping between screen IDs, their view pages, and navigation rules. These configuration files drive the JSF navigation model.

## Common Patterns

### Screen-based organization

Each screen (e.g., ACA001) follows a consistent pattern:

- **`<ScreenID>Bean.java`** — A JSF managed bean with properties that bind to the JSP view. Keep it thin; it should only hold state.
- **`<ScreenID>Logic.java`** — The logic class that contains business operations. Called by the bean or directly from the view during action events.
- **JSP page** — Uses `<jsp:useBean>` to reference the managed bean and renders the HTML response.

### Filter-first architecture

Every HTTP request passes through `X33JVRequestEncodingSjisFilter` before reaching any controller or servlet. This is the intended place to add cross-cutting concerns (encoding, authentication, logging) that apply to all requests.

### JSP-based views with JSF beans

The application uses traditional JSP pages (not Facelets) with JSF managed beans. Pages import bean and logic classes via page directives and instantiate beans using `<jsp:useBean>`. New screens should follow this same pattern for consistency.
