Hi,
I tried according to
https://struts.apache.org/core-developers/validation
Customizing validation messages
XML
This is the example from above:
<field name="username">
<field-validator type="requiredstring">
<message key="errors.required">
<param name="0">getText('username.field.name')</param>
</message>
</field-validator>
</field>
errors.required={0} is required.
username.field.name=Username
The final output will be as follow:
Username is required.
Migrating from Struts1 to Struts7, this looked pretty familiar to me.
I tried
<field name="myObject.myField">
<field-validator type="stringlength">
<param name="maxLength">400</param>
<message key="error.maxlength">
<param name="0">getText('myField.label')</param>
<param name="1">${maxLength}</param>
</message>
</field-validator>
</field>
error.maxlength='{0}' can not be greater than {1} characters.
myField.label=myExample
Output:
{0} can not be greater than null characters.
When I use
error.maxlength={0} can not be greater than {1} characters. (without the ''
which I want to use to emphasize the field name)
Output:
myExample can not be greater than null characters.
I would like to have as output:
'myExample' can not be greater than 400 characters.
The example from the struts page is for requiredstring.
Is there an example for stringlength with maxlenght-output?
And where can I find all possible field-validator types?
Best regards
Ute
> Gesendet: Dienstag, 29. April 2025 um 19:13
> Von: "Lukasz Lenart" <[email protected]>
> An: "Struts Users Mailing List" <[email protected]>
> Betreff: Re: NPE in StrutsUploadedFile
>
> wt., 29 kwi 2025 o 14:59 Tamás Barta <[email protected]> napisał(a):
> > Lukas, could you please fix this bug?
>
> Sure, please register a ticket :)
>
>
> Cheers
> Łukasz
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]