本文介绍了CSS文件中的JSF EL i18n的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的html页面中,我像这样使用Spring消息bean:

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

#{ms.my_text_label}

ms的类型为ReloadableMessageSourceBundle,将通过查找某些资源束文件来转换my_text_label.是否可以在CSS文件中使用它?

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?

推荐答案

免责声明:我忽略了问题中的Spring WebFlow部分,并且好像JSF项目没有使用任何Spring工件.

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

如果通过 <h:outputStylesheet> 而不是纯HTML <link rel="stylesheet">:

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

注意:这不适用于JS文件,甚至不适用于通过 <h:outputScript> . CSS文件中实际上仅出于一个技术原因就支持EL:能够通过#{resource}映射引用CSS背景图像,而无需对整个库和JSF映射进行硬编码.

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.

  • How to reference CSS / JS / image resource in Facelets template?
  • How to reference JSF image resource as CSS background image url

这篇关于CSS文件中的JSF EL i18n的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 06:46