【问题标题】:how to set background image in jsf [duplicate]如何在jsf中设置背景图像[重复]
【发布时间】:2014-07-22 06:52:04
【问题描述】:

如何在 jsf 中设置背景图片。我想将 (imag.jpg) 设置为背景。图片

放置在资源/图像/imag.jpg

<?xml version="1.0" encoding="UTF-8"?>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml"  
      xmlns:f="http://java.sun.com/jsf/core"        
      xmlns:h="http://java.sun.com/jsf/html">  

    <h:head>  
        <title>JSF Example</title>                  
        <style>               
        .Bimage{background-image:url("resources/images/imag.jpg"); }        
        </style>   

    </h:head>  
    <h:body styleClass="Bimage">  

    <h:graphicImage library="images" name="download.jpg"> </h:graphicImage>    

     <h3>JSF 2 Example</h3>  
     <h:form>

        <h:inputText value="#{hello.name}"></h:inputText>  

     </h:form>  

    </h:body>  
</html>  

【问题讨论】:

  • 感谢旅游回复..我改成这样 但没有得到
  • resource 没有s。根据
  • 也这样但没有得到
  • 图片名称是“image1”还是“imag”?

标签: css jsf resources background-image


【解决方案1】:

通过以下代码更改css .Bimage

.Bimage{
     background-image:url(#{request.contextPath}/resources/images/imag.jpg);
 }

.Bimage{
     background-image:url(/Project_Name/resources/images/imag.jpg);
 }

【讨论】:

    猜你喜欢
    • 2016-09-01
    • 1970-01-01
    • 2011-09-02
    • 1970-01-01
    • 2014-07-01
    • 2014-04-07
    • 1970-01-01
    • 2016-08-10
    • 2014-01-19
    相关资源
    最近更新 更多