maven - CSS images not loaded myfaces and primefaces, #{resource['image...']} not working -


i tried many forum didn't found solution working solve problem. using maven project in eclipse make website using myfaces , primefaces. using apache tomcat 8.0.28.

everything in project works fine except loading of images css file. include css in xhtml template files using (between <h:head></h:head>) :

<h:outputstylesheet name="css/styles.css"/> 

my css under /resources/css loaded correctly. not images inside it. tried these solutions :

- background-image: url("#{resource['images/image.jpg']}"); - background: #fff url(../images/image.jpg); - background: #fff url(../images/image.jpg.xhtml); -> works don't know why ?? 

the last line working in first time used solution problem incountered own images has been incountered primefaces css images...

enter image description here

note : when use <h:graphicimage name="images/image.png"> inside xhtml works !

here project structure

my web.xml :

<?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="webapp_id" version="3.1">  <welcome-file-list>   <welcome-file>index.xhtml</welcome-file> </welcome-file-list> <servlet>   <servlet-name>faces servlet</servlet-name>   <servlet-class>javax.faces.webapp.facesservlet</servlet-class>   <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping>   <servlet-name>faces servlet</servlet-name>   <url-pattern>*.xhtml</url-pattern> </servlet-mapping>  <context-param>   <param-name>javax.servlet.jsp.jstl.fmt.localizationcontext</param-name>   <param-value>resources.application</param-value> </context-param> <context-param>   <description>state saving method: 'client' or 'server' (=default). see jsf specification 2.5.2</description>   <param-name>javax.faces.state_saving_method</param-name>   <param-value>client</param-value> </context-param> <context-param>   <param-name>org.apache.myfaces.allow_javascript</param-name>   <param-value>true</param-value> </context-param> <context-param>   <param-name>org.apache.myfaces.pretty_html</param-name>   <param-value>true</param-value> </context-param> <context-param>   <param-name>org.apache.myfaces.detect_javascript</param-name>   <param-value>false</param-value> </context-param> <context-param>   <param-name>org.apache.myfaces.auto_scroll</param-name>   <param-value>true</param-value> </context-param>  <listener>   <listener-class>org.apache.myfaces.webapp.startupservletcontextlistener</listener-class> </listener>  <context-param>   <param-name>primefaces.theme</param-name>   <param-value>glass-x</param-value> </context-param> <security-constraint>   <display-name>security constraint</display-name>   <web-resource-collection>     <web-resource-name>automatic sll forwarding</web-resource-name>     <url-pattern>/*</url-pattern>   </web-resource-collection>   <user-data-constraint>     <transport-guarantee>confidential</transport-guarantee>   </user-data-constraint> </security-constraint>  </web-app> 

my pom.xml :

<repositories>   <repository>     <id>prime-repo</id>     <name>primefaces maven repository</name>     <url>http://repository.primefaces.org</url>     <layout>default</layout>   </repository> </repositories>  <dependencies>   <dependency>    <groupid>junit</groupid>    <artifactid>junit</artifactid>    <version>3.8.1</version>    <scope>test</scope>  </dependency>  <dependency>    <groupid>javax.servlet</groupid>    <artifactid>javax.servlet-api</artifactid>    <version>3.1.0</version>  </dependency>  <dependency>    <groupid>javax.servlet.jsp</groupid>    <artifactid>javax.servlet.jsp-api</artifactid>    <version>2.3.1</version>  </dependency>  <dependency>    <groupid>javax.el</groupid>    <artifactid>javax.el-api</artifactid>    <version>3.0.0</version>  </dependency>  <dependency>    <groupid>org.primefaces</groupid>    <artifactid>primefaces</artifactid>    <version>5.3</version>  </dependency>  <dependency>    <groupid>org.apache.myfaces.core</groupid>    <artifactid>myfaces-api</artifactid>    <version>2.2.10</version>  </dependency>  <dependency>    <groupid>org.apache.myfaces.core</groupid>    <artifactid>myfaces-impl</artifactid>    <version>2.2.10</version>  </dependency>  <dependency>    <groupid>org.apache.myfaces.tomahawk</groupid>    <artifactid>tomahawk20</artifactid>    <version>1.1.14</version>  </dependency>  <dependency>    <groupid>javax.servlet</groupid>    <artifactid>jstl</artifactid>    <version>1.2</version>  </dependency>  <dependency>    <groupid>org.primefaces.themes</groupid>    <artifactid>all-themes</artifactid>    <version>1.0.10</version>  </dependency> </dependencies>  <build>   <finalname>dnsenumartifact</finalname>   <plugins>    <plugin>     <artifactid>maven-compiler-plugin</artifactid>       <configuration>        <source>1.8</source>        <target>1.8</target>      </configuration>    </plugin>  </plugins> </build> 

i don't know problem is, configuration, web.xml, dependencies, tomcat... thank in advance help.

laurent


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -