如何嵌入CSS背景图像链接与JSF? [英] How can I embed an CSS background image link with JSF?

查看:233
本文介绍了如何嵌入CSS背景图像链接与JSF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用JSF为嵌入式样式表动态创建图片网址?

Is there a way to create the image url dynamically for an embedded style sheet using JSF?

示例:

<h:head>
  <style type="text/css">
    .someId { background-image:url(images/example.jpg); }
  </style>
</h:head>

(使用< h:graphicImage library =imagesname =

(using <h:graphicImage library="images" name="logo.gif" /> is not supported for embedded CSS).

推荐答案

如果我正确了解您的问题:

If I correctly understood your question:

在我的项目中,我使用了这种风格:

In my project I've used this style:

<h1
 class="logo"
 style="background:url( #{mainMenuNavigationBean.headerImage} ) no-repeat;">

其中 mainMenuNavigationBean 根据一些条件设置headerImage。

where mainMenuNavigationBean is a session bean where I set the headerImage based on some conditions.

这篇关于如何嵌入CSS背景图像链接与JSF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆