# Getting Started

## What This Project Does

This is a Japanese enterprise web application built on **Fujitsu's Futurity framework** (X33 line). It is a **server-rendered JSF application** that follows a strict Model-View-Logic (MVL) architecture: screen-level XML definitions map to a **Bean** (view state), a **Logic** class (business logic), and a **JSP** (presentation layer). The app handles request encoding via servlet filters and uses XML configuration for screen routing and UI component definitions.

## Recommended Reading Order

1. **Configuration** — Start with `web-full.xml` to understand the servlet entry points and filters that boot the application.
2. **Screen Definition** — Read an XML screen config (e.g. `WEBGAMEN_FULL_ACA001.xml`) to see how a page is wired to its Bean and Logic classes.
3. **View Logic & Bean** — Examine a pair of `*SFLogic` and `*SFBean` classes to understand the business logic and view state for a feature.
4. **JSP View** — Open the corresponding `.jsp` file to see the presentation layer that consumes the Bean's data.

## Key Entry Points

| Class | Path | Role |
|-------|------|------|
| **FacesServlet** | `src/java/javax/faces/webapp/FacesServlet.java` | JSF servlet that processes all `/faces/*` requests. |
| **X33JVRequestEncodingSjisFilter** | `src/java/com/fujitsu/futurity/web/x33/filter/X33JVRequestEncodingSjisFilter.java` | Servlet filter that sets request encoding (SJIS / UTF-8) for Japanese input. |
| **X33AppContextListener** | `src/java/com/fujitsu/futurity/web/x33/listener/X33AppContextListener.java` | Servlet context listener; fires once at application startup for Futurity framework initialization. |
| **Bean (e.g. ACA001SFBean)** | `src/java/eo/web/webview/ACA001SF/ACA001SFBean.java` | View-scoped JavaBean holding form data and UI state for a screen. |
| **Logic (e.g. ACA001SFLogic)** | `src/java/eo/web/webview/ACA001SF/ACA001SFLogic.java` | Contains the business logic invoked during a page action (submit, validate, etc.). |

## Project Structure

```
full-fixture-codebase/
├── koptWebA/
│   └── WebContent/
│       ├── WEB-INF/
│       │   └── web-full.xml          ← Servlet / filter configuration
│       └── wsd/
│           └── ns/jpn/pc/
│               └── FULL_ACA001010PJP.jsp  ← JSP view files
└── src/
    ├── futurity-app/
    │   └── webA/
    │       └── env/
    │           └── view/
    │               └── def/
    │                   └── WEBGAMEN_FULL_ACA001.xml  ← Screen definitions
    └── java/
        ├── com/fujitsu/futurity/web/x33/
        │   ├── filter/
        │   │   └── X33JVRequestEncodingSjisFilter.java  ← Encoding filter
        │   └── listener/
        │       └── X33AppContextListener.java             ← App lifecycle
        ├── eo/web/webview/
        │   └── ACA001SF/
        │       ├── ACA001SFBean.java      ← View Bean
        │       └── ACA001SFLogic.java     ← Business logic
        └── javax/faces/webapp/
            └── FacesServlet.java          ← JSF core servlet
```

**How a request flows through the app:**

```mermaid
flowchart LR
  A["Browser Request"] --> B["FacesServlet"]
  B --> C["X33JVRequestEncodingSjisFilter"]
  C --> D["Screen XML Config"]
  D --> E["Bean (view state)"]
  D --> F["Logic (business logic)"]
  E --> G["JSP View"]
  F --> G
  G --> H["HTML Response"]
```

## Configuration

### `web-full.xml` (Deployment Descriptor)

Location: `full-fixture-codebase/koptWebA/WebContent/WEB-INF/web-full.xml`

This file configures:

- **`X33JVRequestEncodingSjisFilter`** — A servlet filter that intercepts incoming HTTP requests and sets the character encoding. This is essential for Japanese text (Shift-JIS / UTF-8) to be processed correctly.
- **`FacesServlet`** — The JSF servlet mapping. All requests to `/faces/*` are routed through JSF's lifecycle (Restore View → Apply Request Values → Process Validations → Update Model → Invoke Application → Render Response).

### Screen Definition XMLs

Location: `full-fixture-codebase/src/futurity-app/webA/env/view/def/`

Files like `WEBGAMEN_FULL_ACA001.xml` define a single screen (page). Each `<SCREEN>` element declares:

- **`<BL class="...">`** — The fully-qualified **Business Logic** class for the screen.
- **`<SERVICEFORM bean="...">`** — The fully-qualified **Bean** class that holds view state.

This XML-driven approach means **every page in the app follows the same contract**: the XML maps to a `<PackageName><ScreenID>Bean` and `<ScreenID>Logic` pair.

## Common Patterns

### Screen ID Convention

Screen IDs follow the pattern `<Area><SequenceNumber><FunctionSuffix>`, for example:

- `ACA001SF` — Area `ACA`, sequence `001`, suffix `SF` (Screen/Function).
- `FULL_ACA001` — Full-screen version of screen `ACA001`.

When you encounter a new feature, look for the `<SCREEN id="...">` XML to discover the Bean and Logic class names.

### Bean + Logic Pairing

Every screen has exactly two Java classes in the same package:

1. **`<ScreenID>Bean.java`** — Plain JavaBean with properties and getters/setters. Holds form data and UI state.
2. **`<ScreenID>Logic.java`** — Contains the `execute()` method (and any helpers) that implements the business logic for that screen's actions.

### JSP Presentation

JSP files live under `WebContent/wsd/ns/jpn/pc/`. They import the corresponding Bean and Logic classes and use `<jsp:useBean>` to access the Bean's properties for rendering.

### Encoding Filter

All Japanese web apps in the Futurity ecosystem require the `X33JVRequestEncodingSjisFilter`. If you add a new servlet or filter, register it in `web-full.xml` alongside the existing entries. The filter chain ensures the character encoding is set before the JSF lifecycle begins processing the request.
