Liferay 7.2 - Change attribute in CSS from JSP

Amos Fong, modified 5 Years ago. Junior Member Posts: 81 Join Date: 6/25/19 Recent Posts
Hi,

I have the following view.jsp:
&lt;% List<datasource> dataSources = (List<datasource>) request.getAttribute("dataSources"); %&gt;
<aui:container cssclass="my-portlet">
&nbsp; &nbsp; &lt;% for (DataSource dataSource : dataSources) { %&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<aui:container cssClass="title-container" />
&nbsp;&nbsp; &nbsp;&lt;% } %&gt;
</aui:container></datasource></datasource>

And the following css:
.my-portlet {
&nbsp;&nbsp; &nbsp;min-width: 100%;
&nbsp;&nbsp; &nbsp;padding: 50px;
    -webkit-column-count: 4;
&nbsp; &nbsp; -moz-column-count: 4;
&nbsp; &nbsp;&nbsp;column-count: 4;
}

.my-portlet .title-container {
&nbsp;&nbsp; &nbsp;width: 100%;
&nbsp;&nbsp; &nbsp;height: 5px;
&nbsp;&nbsp; &nbsp;background: red;
}

Now, my problem is that each DataSource object has a different background color String which I want to set it as the background color for my title-container. So, it is possible to change my css to set the background attribute in my title-container class to the one of the DataSource object?