Foros de discusión

Failed to load Image in Liferay Portlet

Rounak Dasgupta, modificado hace 9 años.

Failed to load Image in Liferay Portlet

New Member Mensajes: 4 Fecha de incorporación: 13/05/13 Mensajes recientes
My development environment is liferay-portal-6.2-ce-ga2 and production environment is liferay 6.2 EE SP3. I'm able to deploy my dev portlet into prod but the problem that I'm facing is images are not rendering. It says Failed to load image url.

I'm using Liferay-JSF portlet and the image url is creating like /Project-portlet/icon.png. But in prod there are many war file is deployed and when I test with another portlet name something like (assume another portlet name is example-portlet) /example-portlet/icon.png, it works.

Is there any issue with context path of being different liferay version? Need your help.
thumbnail
Andew Jardine, modificado hace 9 años.

RE: Failed to load Image in Liferay Portlet

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hi Rounak,

There shouldn't be -- I just tried it with several of my portlets on my side and all of them worked. Make sure you have the servlet context name exactly as it shows in the directory though including case as as exact match must be found.

For images that you want to use in your portlet, unless you are using relative paths, you might have to use ${request.contextPath} to get the proper servlet path. So if you portlet has docroot/images/my-image.png then in your JSP you should use <img src="${request.contextPath}/images/my-image.png" />
thumbnail
Kyle Joseph Stiemann, modificado hace 9 años.

Moved.

Liferay Master Mensajes: 760 Fecha de incorporación: 14/01/13 Mensajes recientes
Moved to Home » Liferay Faces » Liferay Faces - English
thumbnail
Kyle Joseph Stiemann, modificado hace 9 años.

RE: Failed to load Image in Liferay Portlet

Liferay Master Mensajes: 760 Fecha de incorporación: 14/01/13 Mensajes recientes
Hi Rounak,

Are you using an <img> tag or a JSF tag such as h:graphicImage?

- Kyle