Re: textfield tag not allowing blanks
Greg Huber <[email protected]> Wed, 26 Nov 2025 12:04:04 +0000
| Newsgroups | gmane.comp.jakarta.struts.devel |
|---|---|
| Message-ID | <[email protected]> |
Rechecking this, it seems to be a java templates thing (thought I had
switched to std when checking!) where it uses .isNotBlank(..) where to
make it comparable to std it should be .isNotEmpty(..)
org.apache.struts2.views.java.Attributes
public Attributes addIfExists(String attrName, Object paramValue,
boolean encode) {
if (paramValue != null) {
String val = paramValue.toString();
if (StringUtils.isNotBlank(val))
put(attrName, (encode ?
StringUtils.defaultString(StringEscapeUtils.escapeHtml4(val)) : val));
}
return this;
}
Will do a pr.
Thanks
On 25/11/2025 19:51, Dave Newton wrote:
> On Tue, Nov 25, 2025 at 13:11 Lukasz Lenart:
>> pon., 24 lis 2025 o 20:20 Greg Huber:<[email protected]>
>>> White space, ie space bar on keybpard.
>> I don't see any problem with passing an empty value, it all depends on validators
> assigned to the field.
>
> A long time ago (book era) spaces were fine, and we wrote type converters
> and interceptors to explicitly remove them (eg BigDecimal type converter,
> white space trimmer interceptor—put them in the book because kept using
> them irl)
>
> I don’t know if any of that default behavior changed, but check your
> interceptors and type converters first.
>
> d
>