Fórumok

Liferay Primefaces galleria images not showing

Jay Millan, módosítva 9 év-val korábban

Liferay Primefaces galleria images not showing

New Member Bejegyzések: 3 Csatlakozás dátuma: 2014.12.12. Legújabb bejegyzések
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, módosítva 9 év-val korábban

RE: Liferay Primefaces galleria images not showing

Liferay Legend Bejegyzések: 2655 Csatlakozás dátuma: 2005.07.27. Legújabb bejegyzések
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, módosítva 9 év-val korábban

RE: Liferay Primefaces galleria images not showing

New Member Bejegyzések: 3 Csatlakozás dátuma: 2014.12.12. Legújabb bejegyzések
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, módosítva 9 év-val korábban

RE: Liferay Primefaces galleria images not showing

Expert Bejegyzések: 315 Csatlakozás dátuma: 2013.01.14. Legújabb bejegyzések
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, módosítva 9 év-val korábban

RE: Liferay Primefaces galleria images not showing

New Member Bejegyzések: 3 Csatlakozás dátuma: 2014.12.12. Legújabb bejegyzések
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, módosítva 9 év-val korábban

RE: Liferay Primefaces galleria images not showing

Expert Bejegyzések: 315 Csatlakozás dátuma: 2013.01.14. Legújabb bejegyzések
Glad to hear that it is working for you.