问题
I am trying to display some picture in a primefaces galleria after signing in, in a new xhtml, but nothing happens.
This is the "sing in" page (index.xhtml, "Bejelentkezés" means "Sign in" in hungarian):
When I fill the texts with "viktor" (username and passw too), it navigates to "home.xhtml", which would show the galleria upside, the pictures' name in the middle, and one picture under. But I got this:
If I write "localhost:8080/Primefaces_test1/home.xhtml" into the browser, ENTER, see a miracle, I got this:
As you can see, the names of the pictures are there every time. How could it be possible? My home.xhtml:
GalleriaBean.java:
@ManagedBean(name = "galleriaBean")
@SessionScoped
public class GalleriaBean {
private List<String> images;
private String image;
@PostConstruct
public void init() {
images = new ArrayList<>();
for(int i=1; i<=6; i++) {
images.add(i+".jpg");
}
image = images.get(0);
}
public List<String> getImages() {
return images;
}
public void setImages(List<String> images) {
this.images = images;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
}
The project:
Any ideas?
And an another question.. Why don't the pictures in the galleria show the right size, like the lonely picture under?
回答1:
Try to set ajax="false" in the p:commandButton element.
来源:https://stackoverflow.com/questions/15256502/pgalleria-doesnt-show-after-sign-up-but-directly-yes