I'm trying to use the Primefaces JSF component called contentFlow
, which is demonstrated here: http://www.primefaces.org/showcase/ui/multimedia/contentFlow.xhtml
I added two images to the backing bean. They both can be displayed without using contentFlow
, so they are available and at the right place. The problem is, that the contentFlow
only shows the currently selected image. The expected behaviour is, that it displays all other images, too.
I googled alot and also found the documentation of Primefaces components to verify my XHTML. I also changed the JSF log level to see all debug messages, but JSF keeps telling me that everything is fine.
I've done nothing more than the showcase says, except for the configuration of the project. Here is a summary of my setting:
- I'm using Apache Tomcat 8.0.39 on Windows x64
- Firefox 50.0.2 and Chrome Version 55.0.2883.75 m (64-bit) are showing the same results (only the currently selected image is visible)
- I'm using Java 8
And these are the project's dependencies
<dependency> <groupId>org.primefaces</groupId> <artifactId>primefaces</artifactId> <version>6.0.RC4</version> </dependency> <dependency> <groupId>com.sun.faces</groupId> <artifactId>jsf-api</artifactId> <version>2.2.14</version> </dependency> <dependency> <groupId>com.sun.faces</groupId> <artifactId>jsf-impl</artifactId> <version>2.2.14</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency>
This is my backing bean:
package de.schuettec.jsfquestion.contentFlow;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
@ManagedBean
public class Images {
private List<String> images;
@PostConstruct
public void init() {
images = new ArrayList<String>();
images.add("img-01.png");
images.add("img-02.png");
}
public List<String> getImages() {
return images;
}
}
This is my XHTML page:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h:form>
<p:contentFlow value="#{images.images}" var="image">
<p:graphicImage name="/images/#{image}" styleClass="content" />
<div class="caption">#{image}</div>
</p:contentFlow>
</h:form>
</h:body>
</html>
I've created a minimal reproducing example, which is available via GitHub here https://github.com/schuettec/jsf-question. This is a full Maven project that reproduces this issue.
I would appreciate if someone of the JSF/Primefaces experts can have a look at this issue. I like JSF and the Primefaces components and really want to understand whats wrong here.
Thank you in advance!