'How to pass an array argument from one page to a fragment in thymeleaf template

I am trying to pass an array argument to a fragment. Say I have a list called bar in foo.html context. I am passing it to header.html using the below code

<div th:replace="fragment/header :: header(${bar})"

and in my header.html I am receiving this as

<table th:fragment="header(bar)"> .When I try to access this it throws EL1012E: Cannot index into a null value

How do I pass an array in context to another fragment.

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source