Skip to content

WW-5847 fix(core): preselect multiple values in the doubleselect second list - #2127

Merged
lukaszlenart merged 1 commit into
support/struts-6-x-xfrom
WW-5847-doubleselect-multiple-preselect-6x
Nov 7, 2026
Merged

lukaszlenart merged 1 commit into
support/struts-6-x-xfrom
WW-5847-doubleselect-multiple-preselect-6x

Conversation

@lukaszlenart

Copy link
Copy Markdown
Member

Fixes WW-5847

Cherry-pick of #2126 onto support/struts-6-x-x. The only differences are the parameters. template prefix and the 6.x imports.

With doubleMultiple set, the simple theme's doubleselect.ftl interpolated the bound value of the second list into the generated script unquoted. A plain String became a bare identifier and the script failed on page load, a Collection rendered through toString with the same result, and a String[] failed the template render. The branch was also chosen by the attribute's presence, so doubleMultiple="false" took it too.

Change

  • DoubleListUIBean resolves the second list's value once and also exposes it as a list of strings (doubleNameValues), normalised from a String, a Collection or an array through MakeIterator.
  • The template emits that list as var <id>Selected = [...], an array of quoted, JS-escaped string literals written the same way the single-value branch and the option values already are, and the preselect loop compares against it.
  • The branch is selected by the boolean value of doubleMultiple.

Compatibility

Preselecting several values in the second list works. The single-value path renders exactly as before; the existing DoubleSelect-* fixtures are unchanged.

Tests

DoubleSelectMultipleTest covers a Collection (full fixture DoubleSelect-7.txt), a String, a String[], values containing quotes, backslashes and a closing script tag rendering as string literals, and doubleMultiple="false" taking the single-value path. Full core suite green.

🤖 Generated with Claude Code

…nd list

With doubleMultiple set, the simple theme interpolated the bound value
of the second list into the generated script unquoted, so a plain
String became a bare identifier, a Collection rendered through
toString, and a String[] failed the template. The branch was also
selected by the attribute's presence, so doubleMultiple="false" took it.

DoubleListUIBean now also exposes the value as a list of strings, and
the template emits it as an array of quoted, JS-escaped string literals,
the same way the single-value branch and the option values are already
written. The branch is selected by the attribute's boolean value.

Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
(cherry picked from commit 1fb9100)
@lukaszlenart
lukaszlenart marked this pull request as ready for review November 7, 2026 19:44
@sonarqubecloud

sonarqubecloud Bot commented Nov 7, 2026

Copy link
Copy Markdown

@lukaszlenart
lukaszlenart merged commit f040b94 into support/struts-6-x-x Nov 7, 2026
10 checks passed
@lukaszlenart
lukaszlenart deleted the WW-5847-doubleselect-multiple-preselect-6x branch November 7, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant