Lukasz Lenart created WW-5784:
---------------------------------
Summary: Allow prefix matching of field names on the fielderror tag
Key: WW-5784
URL: https://issues.apache.org/jira/browse/WW-5784
Project: Struts 2
Issue Type: Improvement
Components: Plugin - Tags
Reporter: Lukasz Lenart
Follow-up to WW-3624, which adds a {{regex}} attribute to {{<s:fielderror>}}.
The most common use of that attribute is showing every error under one path,
e.g. all errors for a single row inside an iterator. With regex this requires
escaping by hand:
{code:xml}<s:fielderror regex="true">
<s:param>^ledger\.records\[<s:property value="#row.index"/>\]\..*</s:param>
</s:fielderror>
{code}
A forgotten escape ({{.}} or {{[}}) silently matches more keys than intended.
Proposal: add a {{fieldNamePrefix}} attribute that selects every field error
whose key starts with the given value, with no escaping and no pattern
compilation:
{code:xml}<s:fielderror fieldNamePrefix="ledger.records[%{#row.index}]."/>
{code}
Scope:
* {{FieldError}} component and {{FieldErrorTag}}
* {{simple}} and {{html5}} {{fielderror.ftl}} templates
* javatemplates {{FieldErrorHandler}}
The attribute is additive and opt-in; existing exact-name matching and the
{{regex}} attribute from WW-3624 stay unchanged. How it combines with
{{fieldName}}, nested params and {{regex}} on the same tag is to be decided in
the design.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)