1

I am trying to follow the primefaces showcase code that is posted on their website here. I have my code set up exactly the same way from what I can tell, but when I run my code all I see is my images displayed on the screen without being shuffled like they are suppose to. I am not sure of what I am doing wrong.

header.xhtml:

<p:imageSwitch effect="shuffle">
    <ui:repeat value="#{imagesView.images}" var="image" size="2">
        <p:graphicImage name="/images/#{image}" />
    </ui:repeat>
</p:imageSwitch> 

ImagesView.java

package src.main.java.managedController;

import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;

@ManagedBean
public class ImagesView {

    private List<String> images;

    @PostConstruct
    public void init() {
        images = new ArrayList<String>();

        for (int i = 1; i <= 2; i++) {
            images.add("header" + i + ".jpg");
        }
    }

    public List<String> getImages() {
        return images;
    }
}
Tiny
  • 27,221
  • 105
  • 339
  • 599
level2fast
  • 31
  • 3

0 Answers0