aspose file tools*
The moose likes JSP and the fly likes ContextPath Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "ContextPath Query" Watch "ContextPath Query" New topic
Author

ContextPath Query

Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 477
Hi Everyone,

I am trying to display an image in a JSP using JFreeChart.
I have this code in the a scriptlet tag:

But when run the jsp on the server i get the following error:

Is the above code correct?
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Somnath Mallick wrote:

I think, the exception explain it all. Please make sure that you have "WebContent\images\chart.png " directory in your web app folder.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 477
\WebContent\images\chart.png exists. But still i get this error!
sathish Tl
Greenhorn

Joined: Sep 02, 2008
Posts: 7
Check request.getContextPath() contians any "%20" instead of space


Sathish TL
SCJP 5,SCWCD 5
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

I think, you won't require context path because you are referencing file from the server jsp, so simple relative path will work, like try
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61237
    
  66

"satish TL", please check your private messages for an important administrative matter. Again.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61237
    
  66

The context path is used when forming URLS, not file paths.
 
Don't get me started about those stupid light bulbs.
 
subject: ContextPath Query