Foren

Liferay Primefaces galleria images not showing

Jay Millan, geändert vor 9 Jahren.

Liferay Primefaces galleria images not showing

New Member Beiträge: 3 Beitrittsdatum: 12.12.14 Neueste Beiträge
Hi,

Im currently studying liferay with primefaces. Im testing the galleria component from the tutorial and I am getting this error for each image.

Resource handler=[com.liferay.faces.bridge.application.ResourceHandlerOuterImpl@1c5b6d] was unable to create a resource for resourceName=[/views/demo/images/nature/test4.jpg] libraryName=[null] contentType=[null]


view.xhtml

<!--?xml version="1.0"?-->

<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:ui="http://java.sun.com/jsf/facelets">
	<h:head />
	<h:body>
		<h:outputtext value="Gallery" />

		<h:graphicimage value="/views/demo/images/nature/test3.jpg" />

		<p:galleria value="#{imagesView.images}" var="image" panelwidth="300" panelheight="200" showcaption="true">
			<p:graphicimage name="/views/demo/images/nature/#{image}" alt="Image Description for #{image}" title="#{image}" />
		</p:galleria>

	</h:body>
</f:view>



ImagesView.java
package com.jpportlets.managedbeans;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;

@ManagedBean
@ViewScoped
public class ImagesView implements Serializable {
     
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private List<string> images;
     
    @PostConstruct
    public void init() {
    	FacesContext.getCurrentInstance().getExternalContext().getSession(true);
    	
    	images = new ArrayList<string>();
        for (int i = 1; i &lt;= 4; i++) {
            images.add("test" + i + ".jpg");
        }
    }
 
    public List<string> getImages() {
        return images;
    }
}</string></string></string>



Attached are my eclipse project content and the result screen.


Thanks.
thumbnail
Neil Griffin, geändert vor 9 Jahren.

RE: Liferay Primefaces galleria images not showing

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
Hi Yurg,

When you get a chance, please let us know the URL that you see for the missing image. You can do this by hovering your mouse over the missing image in the browser, and then right click to get a context menu to see if it will let you copy the URL.

Kind Regards,

Neil
Yurg Block, geändert vor 9 Jahren.

RE: Liferay Primefaces galleria images not showing

New Member Beiträge: 3 Beitrittsdatum: 12.12.14 Neueste Beiträge
Neil Griffin:
Hi Yurg,

When you get a chance, please let us know the URL that you see for the missing image. You can do this by hovering your mouse over the missing image in the browser, and then right click to get a context menu to see if it will let you copy the URL.

Kind Regards,

Neil



Hi Neil,

all images have this URL

http://localhost:8080/web/guest/RES_NOT_FOUND
thumbnail
Vernon Singleton, geändert vor 9 Jahren.

RE: Liferay Primefaces galleria images not showing

Expert Beiträge: 315 Beitrittsdatum: 14.01.13 Neueste Beiträge
Hello Yurg,

I was able to reproduce your error when I use the "name" attribute in the p:graphicImage tag as you have shown us.
Yurg Block:
		<p:galleria value="#{imagesView.images}" var="image" panelwidth="300" panelheight="200" showcaption="true">
			<p:graphicimage name="/views/demo/images/nature/#{image}" alt="Image Description for #{image}" title="#{image}" />
		</p:galleria>


Try using the "value" attribute of the p:graphicImage tag. (I'm pretty sure that the "name" attribute must always be used with the "library" attribute, but your resources are not stores in a "resources" directory, so JSF will not be able to find them using the "name" attribute).

Hope that helps,
Vernon
Yurg Block, geändert vor 9 Jahren.

RE: Liferay Primefaces galleria images not showing

New Member Beiträge: 3 Beitrittsdatum: 12.12.14 Neueste Beiträge
Vernon Singleton:
Hello Yurg,

I was able to reproduce your error when I use the "name" attribute in the p:graphicImage tag as you have shown us.
Yurg Block:
		<p:galleria value="#{imagesView.images}" var="image" panelwidth="300" panelheight="200" showcaption="true">
			<p:graphicimage name="/views/demo/images/nature/#{image}" alt="Image Description for #{image}" title="#{image}" />
		</p:galleria>


Try using the "value" attribute of the p:graphicImage tag. (I'm pretty sure that the "name" attribute must always be used with the "library" attribute, but your resources are not stores in a "resources" directory, so JSF will not be able to find them using the "name" attribute).

Hope that helps,
Vernon



Hi Vernon,

Thank you very much, it solved the problem.

Cheers mate!
thumbnail
Vernon Singleton, geändert vor 9 Jahren.

RE: Liferay Primefaces galleria images not showing

Expert Beiträge: 315 Beitrittsdatum: 14.01.13 Neueste Beiträge
Glad to hear that it is working for you.