[
https://issues.apache.org/jira/browse/WW-3624?focusedWorklogId=1047805&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1047805
]
ASF GitHub Bot logged work on WW-3624:
--------------------------------------
Author: ASF GitHub Bot
Created on: 16/Oct/26 11:00
Start Date: 16/Oct/26 11:00
Worklog Time Spent: 10m
Work Description: lukaszlenart opened a new pull request, #2036:
URL: https://github.com/apache/struts/pull/2036
Fixes [WW-3624](https://issues.apache.org/jira/browse/WW-3624)
## Summary
Adds a `regex` attribute (default `false`) to `<s:fielderror>`. When
enabled, `fieldName` and nested `<s:param>` values are regular expressions
matched against the whole field error name, e.g. all errors of one iterated row:
```jsp
<s:fielderror regex="true">
<s:param>ledger\.records\[<s:property
value="#row.index"/>\]\..*</s:param>
</s:fielderror>
```
- `simple` and `html5` `fielderror.ftl`: in regex mode the template first
collects the matching error keys, then renders them through the existing loop.
The exact-match path is unchanged.
- javatemplates `FieldErrorHandler`: same matching via
`Pattern.matcher(...).matches()`.
- A field error matched by several patterns is rendered once; errors keep
the order in which validation recorded them.
- `regex` is reset in `clearTagStateForTagPoolingServers`.
This follows the design of the patch attached to the ticket, ported to the
current templates (it only covered `simple`). Prefix matching without escaping
is tracked separately in
[WW-5784](https://issues.apache.org/jira/browse/WW-5784).
## Notes
- Pre-existing difference, left as is: when no listed name matches,
`FieldErrorHandler` writes an empty `<ul class="errorMessage"></ul>` while the
FreeMarker themes write nothing. Regex mode follows each renderer's existing
behaviour.
- The fielderror tag page in struts-site needs the new attribute.
## Test plan
- [x] New `FieldErrorTagTest` cases for `simple` and `html5` (row match, no
match, whole-name match, no duplicates, literal match without `regex`,
tag-pooling reset); the matching cases failed before the template change
- [x] New `FieldErrorTest` cases in javatemplates
- [x] `core`: 3490 tests, 0 failures; `javatemplates`: 83 tests, 0 failures
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Issue Time Tracking
-------------------
Worklog Id: (was: 1047805)
Remaining Estimate: 0h
Time Spent: 10m
> allow regex matching on fielderror tag
> --------------------------------------
>
> Key: WW-3624
> URL: https://issues.apache.org/jira/browse/WW-3624
> Project: Struts 2
> Issue Type: New Feature
> Components: Core Actions
> Affects Versions: 2.2.3
> Environment: n/a
> Reporter: Jason Pyeron
> Assignee: Lukasz Lenart
> Priority: Major
> Fix For: 7.5.0
>
> Attachments:
> struts2-trunk-WW-3624-baselined-without-WW-3622-or-WW-3623.patch,
> struts2-trunk-WW-3624-depends-on-WW-3622-and-WW-3623.patch,
> struts2-trunk-WW-3624-site-artifacts-from-maven.patch
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Very happy with the iterator and complicated sub fields...
> {code:xml}
> <s:fielderror regex="true">
> <s:param>^ledger\.records\[<s:property value="#row.index" />\].*</s:param>
> </s:fielderror>
> {code}
> the patch attached is baseline against the trunk, it assumes WW-3622 and
> WW-3623 have not been commited yet.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)