[
https://issues.apache.org/jira/browse/WW-5850?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Lukasz Lenart updated WW-5850:
------------------------------
Description:
Struts has two mechanisms for keeping form state across several requests
(wizard-like flows): the {{scope}} interceptor ({{ScopeInterceptor}}) and the
{{scopedModelDriven}} interceptor. Neither has a lifecycle. This ticket adds
declarative multi-step flows, implemented by a new dedicated {{flow}}
interceptor, so there is a full alternative to {{scope}}.
{{ScopedModelDrivenInterceptor}} and {{ScopedModelDriven}} are not changed;
apps that declare no flow keep exactly today's behaviour.
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 identified by namespace + name: a 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 with a new model by default;
the action can opt in to resuming an existing model per request.
* *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 when the action ran and returned neither {{input}} nor {{error}}.
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
namespace and name.
* One running flow per user per flow.
* Flow definitions are validated at startup (one start, at least one end,
consistent model type, {{flow}} interceptor present in the stack).
* The {{flow}} interceptor is added to {{defaultStack}} and does nothing for
actions without a flow.
h2. Planned sequence for ScopeInterceptor
* 7.6.0 — this ticket: the alternative ships. {{ScopeInterceptor}} is unchanged.
* 7.7.0 — deprecate {{ScopeInterceptor}}, with a migration note to declarative
flows.
* 8.0.0 — remove {{ScopeInterceptor}}.
h2. Out of scope
* Changing {{ScopedModelDrivenInterceptor}} or {{ScopedModelDriven}}.
* Deprecating or changing {{ScopeInterceptor}}.
* 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.
Design document: https://github.com/apache/struts/pull/2130
was:
Struts has two mechanisms for keeping form state across several requests
(wizard-like flows): the {{scope}} interceptor ({{ScopeInterceptor}}) and the
{{scopedModelDriven}} interceptor. This ticket gives {{scopedModelDriven}} an
explicit flow lifecycle so it becomes a full alternative to {{scope}}.
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. Planned sequence for ScopeInterceptor
* 7.6.0 — this ticket: the alternative ships. {{ScopeInterceptor}} is unchanged.
* 7.7.0 — deprecate {{ScopeInterceptor}}, with a migration note to declarative
flows.
* 8.0.0 — remove {{ScopeInterceptor}}.
h2. Out of scope
* Deprecating or changing {{ScopeInterceptor}}.
* 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.
> Add declarative multi-step flows with a dedicated flow interceptor
> ------------------------------------------------------------------
>
> 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
> Assignee: Lukasz Lenart
> Priority: Major
> Fix For: 7.6.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Struts has two mechanisms for keeping form state across several requests
> (wizard-like flows): the {{scope}} interceptor ({{ScopeInterceptor}}) and the
> {{scopedModelDriven}} interceptor. Neither has a lifecycle. This ticket adds
> declarative multi-step flows, implemented by a new dedicated {{flow}}
> interceptor, so there is a full alternative to {{scope}}.
> {{ScopedModelDrivenInterceptor}} and {{ScopedModelDriven}} are not changed;
> apps that declare no flow keep exactly today's behaviour.
> 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 identified by namespace + name: a 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 with a new model by
> default; the action can opt in to resuming an existing model per request.
> * *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 when the action ran and returned neither {{input}} nor {{error}}.
> 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
> namespace and name.
> * One running flow per user per flow.
> * Flow definitions are validated at startup (one start, at least one end,
> consistent model type, {{flow}} interceptor present in the stack).
> * The {{flow}} interceptor is added to {{defaultStack}} and does nothing for
> actions without a flow.
> h2. Planned sequence for ScopeInterceptor
> * 7.6.0 — this ticket: the alternative ships. {{ScopeInterceptor}} is
> unchanged.
> * 7.7.0 — deprecate {{ScopeInterceptor}}, with a migration note to
> declarative flows.
> * 8.0.0 — remove {{ScopeInterceptor}}.
> h2. Out of scope
> * Changing {{ScopedModelDrivenInterceptor}} or {{ScopedModelDriven}}.
> * Deprecating or changing {{ScopeInterceptor}}.
> * 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.
> Design document: https://github.com/apache/struts/pull/2130
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)