how to set background image in jsf.i want to set (imag.jpg)as background. the images
are placed at resouces/images/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>
resourcewithouts. And depending on what you have inside <style> tag, the definition CSS code should looke like:.Bimage{background-image:url("#{resource['images:image1.jpg']}");}. Better to copy-paste it.