{"inpage":"1"}

Nesting pages

A BESPA page is a self-contained unit: its own AppBar, its own state, its own redraw boundary. The framework lets you embed one page inside another so you can compose larger UIs out of those units. The nested page doesn’t know — or care — whether it’s the top of the document or sitting inside a modal frame somewhere.

Four modalities

The same nested page can appear in any of these containers. Pick a button to embed /basics/nested using that modality — and notice how the embedded page keeps its own counter state independent of this outer page:

Inline embed
{"_back":"^?inpage="}

Nested page

This page has no knowledge of what container it is nested inside — if any. Its state, navigation, and redraws are entirely self-contained.

Page 1

Increment

A back arrow shows in the AppBar so the user can return to the container. Additional close controls — link, button — can also use WithHrefBack:

How it works

Each container widget — Modal, SidePanel, or a plain GroupingFrame — embeds the nested handler with EmbedHandler. The handler is invoked against an in-memory response recorder, the resulting HTML is sliced out of its <body> tag, and dropped into the container. The nested page renders exactly the same widgets it would render on its own URL.

Two things make the nesting clean:

When to use which

See also

Embedded pages: overview — the three embedding mechanisms compared in one table.

Targeting frames — how to direct a click at a specific named embedded frame rather than the current page.

The action-URL pattern — the ^ prefix used in the return-link plumbing.

Build → Modals & side panels — the consumer-side recipes for the most common embeds.