Fórumok
Failed to load Image in Liferay Portlet
Rounak Dasgupta, módosítva 9 év-val korábban
Failed to load Image in Liferay Portlet
New Member Bejegyzések: 4 Csatlakozás dátuma: 2013.05.13. Legújabb bejegyzések
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.
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.
Andew Jardine, módosítva 9 év-val korábban
RE: Failed to load Image in Liferay Portlet
Liferay Legend Bejegyzések: 2416 Csatlakozás dátuma: 2010.12.22. Legújabb bejegyzések
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" />
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" />
Kyle Joseph Stiemann, módosítva 9 év-val korábban
Moved.
Liferay Master Bejegyzések: 760 Csatlakozás dátuma: 2013.01.14. Legújabb bejegyzések
Kyle Joseph Stiemann, módosítva 9 év-val korábban
RE: Failed to load Image in Liferay Portlet
Liferay Master Bejegyzések: 760 Csatlakozás dátuma: 2013.01.14. Legújabb bejegyzések
Hi Rounak,
Are you using an <img> tag or a JSF tag such as h:graphicImage?
- Kyle
Are you using an <img> tag or a JSF tag such as h:graphicImage?
- Kyle