Malek Yahyaoui
Malek Yahyaoui

Reputation: 75

Generate CSS from JSF managed bean

I have this CSS code:

td[data-date='2016-03-08']{
  background-color: #F7F7F7;
}

I want to apply it on several dates that I want to load from a database. All this could happen inside my JSF managed bean where I generate the CSS code.

So my question is, how can I apply the CSS that I'm gonna get from my JSF managed bean?

Upvotes: 3

Views: 747

Answers (1)

BalusC
BalusC

Reputation: 1109272

One way is to print it as body of HTML <style> tag which you put in HTML head.

<h:head>
    ...
    <style>#{bean.css}</style>
</h:head>

Upvotes: 5

Related Questions