i am making a web application which plots graph based on the date from database i use jfreechart and saving the graph as a image.And trying to display it on my jsp page by specifing the image path.
in jsp i am givin this
<img src="C:/Program Files/Apache Software Foundation/Tomcat 7.0/webapps/yeargraph.jpg" class="myimageclass" alt="Graph Cannot be Displayed Due to some internal error"/>
inside my jfreechart program i give
String fileName="C:/Program Files/Apache Software Foundation/Tomcat 7.0/webapps/yeargraph.jpg";
to save chart i am able to save the graph and display it on my jsp file if i run project in my eclipse Indigo but if i export it to a WAR file and paste WAR file in Tomcat/webapps/folder and then run brwoser “localhost:8080/projetcname/” i can see my project working fine But if I try to plot graph its is not showing the image in my jsp page y is it so am i doing something wrong pleas ehelp thanks in advance.
Note:Based the users input my application will generate different graphs by overwriting same image file so even this should be taken care of
You will have all kinds of problems when you deploy that to a production server. Try a different aproach:
– find a folder you know you will have permissions when in production;
– give jfreechart the path “[folder with permissions]/charts_temp_folder/yeargraph.jpg”;
– write a small servlet to read the file and serve it;
– point your jsp to that folder;
Let us know how that goes.