Lukasz Lenart created WW-5850:
---------------------------------

             Summary: Add declarative multi-step flows to ScopedModelDriven and 
deprecate ScopeInterceptor
                 Key: WW-5850
                 URL: https://issues.apache.org/jira/browse/WW-5850
             Project: Struts 2
          Issue Type: New Feature
          Components: Core, Core Interceptors, Plugin - Convention
            Reporter: Lukasz Lenart
             Fix For: 7.6.0


Struts has two mechanisms for keeping form state across several requests 
(wizard-like flows): the {{scope}} interceptor ({{ScopeInterceptor}}) and the 
{{scopedModelDriven}} interceptor. This ticket consolidates on 
{{scopedModelDriven}} by giving it an explicit flow lifecycle, and deprecates 
{{ScopeInterceptor}}.

User poll on the mailing list: "Is anyone using the scope interceptor?" (user@, 
2026-10-09). One reply, describing a multi-page form flow, which this feature 
covers.

h2. Proposal

A flow is a named set of actions sharing one model stored in the session. Each 
action declares the flow name and its role, in {{struts.xml}} or with a 
Convention annotation:
* *start* — exactly one per flow. Begins the flow. Whether it creates a new 
model or picks up an existing one is configurable by the developer.
* *step* — any number. Requires a running flow and works on the stored model.
* *end* — any number. Requires a running flow; the model is removed from the 
session after the action runs.

Behaviour:
* A step or end action requested with no running flow redirects to the flow's 
start action.
* Multiple flows can be defined in one configuration, distinguished by name.
* One running flow per user per flow name.
* Flow definitions are validated at startup (one start, at least one end, 
consistent model type).

h2. Deprecation

{{ScopeInterceptor}} is deprecated with {{@Deprecated(forRemoval = true)}}, 
with a migration note showing a {{scope}}-based flow rewritten as a declarative 
flow. Removal is tracked separately.

h2. Out of scope
* Visualising flows (Config Browser plugin, IntelliJ IDEA plugin) — possible 
follow-up.
* Independent concurrent runs of the same flow in one session (e.g. two browser 
tabs).
* Application-scoped state.

A design document will be attached via the pull request.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to