0

In my html pages I use the Spring message bean like so:

#{ms.my_text_label}

ms is of type ReloadableMessageSourceBundle and will translate my_text_label by looking in some resource bundle files. Can I make it possible to use this in my CSS files as well?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
KOT
  • 1,986
  • 3
  • 21
  • 35

1 Answers1

0

Disclaimer: I'm ignoring the Spring WebFlow part in the question and do as if the JSF project doesn't use any Spring artifacts.


You can just use EL in CSS files the usual way if you load the CSS file via <h:outputStylesheet> instead of plain HTML <link rel="stylesheet">:

<h:outputStylehseet name="some.css" />

Note: this doesn't work for JS files, even not the ones loaded via <h:outputScript>. EL is supported in CSS files for actually only one technical reason: being able to reference CSS background images via #{resource} mapping without the need to hardcode whole library and JSF mapping.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • It seems like the resource thing works. But when I want to access my bean #{ms.xxxx} it just outputs everything like a string. Should any EL expression work? – KOT Sep 10 '13 at 07:41