I'm trying to convert String array to String using Thymeleaf.
th:value="${#strings.arrayJoin(result.param.searchCondition.mstoneIds, ',')}"
The problem, that if my array is null I get an exception. Are there any null safe ways to convert Array to String? Thanks.
You could do a conditional check like this
th:value="${result.param.searchCondition.mstoneIds != null} ? ${#strings.arrayJoin(result.param.searchCondition.mstoneIds, ',')} : 'null value'"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With