Problems with displaying image in portlet using jsf
I need some help with showing images in my portlet. I have images somewhere on HDD. I wrote servlet ImageServlet with d开发者_StackOverflow社区oGet() method. I registered servlet in web.xml with mapping /images/*.
The problem begins when i try to show image:
<h:graphicImage url="/images/image.png" />
The doGet() method in servlet is not called. HTML output I get is:
<img src="/PortletName/images/image.png"/>
However when I'm using other tag, for example:
<jsp:include file="/images/image.png"/>
doGet() in ImageServlet is called (it doesn't work obviously, but it shows that servlet is registered correctly).
I tried mapping /PortletName/images/*, but it didn't help. And I can't write url without '/' in the beginning (I get an exception - Liferay forbids it).
Am I missing something while calling servlet from h:graphicImage? Or is there any way to get rid of /PortletName/ in the generated HTML? Or is there other way to display image (using include or something)?
Help would be appreciated :)
Edit: JSF 1.1; DTD portlet application 4.3.0; portlet-app_1_0.xsd; org.apache.portals.bridges.portletfilter.FilterPortlet
I managed to do it. I used Liferay PortalDelegateServlet: http://longgoldenears.blogspot.com/2008/03/portaldelegateservlet-servlet-session.html
and I used <img>
tag.
精彩评论