Forums

Home » Liferay Portal » English » 2. Using Liferay » General

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Sanket Gosavi
Current Url generates Exception:NULL..........
March 7, 2012 7:37 AM
Answer

Sanket Gosavi

Rank: Junior Member

Posts: 35

Join Date: December 24, 2011

Recent Posts

M not able to display any image on portlet................
<img src="H:/arr.jpg" height="100" width="200"/>
<liferay-ui:png-image image="H:/arr.jpg" height="100" width="500"></liferay-ui:png-image>
none of it works......
12:50:37,084 INFO [PortalImpl:3829] Current URL /en_GB/web/sanketgosavi/arr.png generates exception: null
Ravi Kumar Gupta
RE: Current Url generates Exception:NULL..........
March 7, 2012 8:35 AM
Answer

Ravi Kumar Gupta

Rank: Liferay Legend

Posts: 1303

Join Date: June 23, 2009

Recent Posts

Try putting that image in your portlet. Like if that is in your-portlet/images/arr.png then use
1<img src='<%=request.getContextPath()%>/images/arr.png' />
David H Nebinger
RE: Current Url generates Exception:NULL..........
March 7, 2012 8:35 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11047

Join Date: September 1, 2006

Recent Posts

You cannot use fixed paths to images, all images must be relative to the web application.

That is a basic web server development thing which you should already be aware of to undertake web development.
Sanket Gosavi
RE: Current Url generates Exception:NULL..........
March 7, 2012 11:02 AM
Answer

Sanket Gosavi

Rank: Junior Member

Posts: 35

Join Date: December 24, 2011

Recent Posts

i knw dat...i want a way to do that
David H Nebinger
RE: Current Url generates Exception:NULL..........
March 7, 2012 11:08 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11047

Join Date: September 1, 2006

Recent Posts

You cannot. It's an application server thing, not just something you can override. It is there to ensure that you do not serve up resources outside of the application container, which would be a potential security leak.
Sanket Gosavi
RE: Current Url generates Exception:NULL..........
March 7, 2012 10:57 PM
Answer

Sanket Gosavi

Rank: Junior Member

Posts: 35

Join Date: December 24, 2011

Recent Posts

Well...plzzzzz tell me wht i hav do to display image on d portlet....
Ravi Kumar Gupta
RE: Current Url generates Exception:NULL..........
March 7, 2012 11:17 PM
Answer

Ravi Kumar Gupta

Rank: Liferay Legend

Posts: 1303

Join Date: June 23, 2009

Recent Posts

As I previously mentioned and David also explaining, image should be in your document root. If you are not doing so, then serve those images using a different method. Which is not at all recommended, will decrease performance and not tested by me.. emoticon

You can write a method which loads image content from local file and sends it to application. serveResource() method may be used, I guess. But for that you will need to change all urls to get resources by serveResource.. I don't know whether its possible but you can try..

David: is that really possible?
Sanket Gosavi
RE: Current Url generates Exception:NULL..........
March 7, 2012 11:55 PM
Answer

Sanket Gosavi

Rank: Junior Member

Posts: 35

Join Date: December 24, 2011

Recent Posts

It worked....thnks.....Can i display text keeping the image as background?
Ravi Kumar Gupta
RE: Current Url generates Exception:NULL..........
March 8, 2012 1:17 AM
Answer

Ravi Kumar Gupta

Rank: Liferay Legend

Posts: 1303

Join Date: June 23, 2009

Recent Posts

Of course yes... depends on how you are writing that.
Sanket Gosavi
RE: Current Url generates Exception:NULL..........
March 8, 2012 1:32 AM
Answer

Sanket Gosavi

Rank: Junior Member

Posts: 35

Join Date: December 24, 2011

Recent Posts

how?..is der any attribute or somthing...
Ravi Kumar Gupta
RE: Current Url generates Exception:NULL..........
March 8, 2012 1:38 AM
Answer

Ravi Kumar Gupta

Rank: Liferay Legend

Posts: 1303

Join Date: June 23, 2009

Recent Posts

Will background-image property of css not help? check this http://www.w3schools.com/css/css_background.asp

Just place the image url at appropriate position. Suppose abc is the id of the element you want to set background of..
1
2#abc{background-image:url('paper.gif');}


HTH
Haris Tasawar
RE: Current Url generates Exception:NULL..........
February 22, 2013 8:02 AM
Answer

Haris Tasawar

Rank: Junior Member

Posts: 35

Join Date: June 4, 2012

Recent Posts

i want to do this too... but instead of an image, i want to display a PDF file, how would that work. If its possible, let me know.

Thanks.
Haris