Hi i am acutally tring to create and display an image using a session bean.
Here is the code of the method responsable of creating the image.
try{
//gets context path
FacesContext facesContext = FacesContext.getCurrentInstance();
ServletContext servletContext = (ServletContext) facesContext.getExternalContext().getContext(); String docBase = servletContext.getRealPath(".");
ChartServer chart1 = new ChartServer();
System.
out.println("getChart() "+docBase + File.separator+"data"+File.separator+"samples.cfx"); chart1.importChart(FileFormat.XML, docBase + File.separator+"data"+File.separator+"samples.cfx");
chart1.openData(COD.VALUES,20,20);for(int i=0; i < 20; i++)
{
chart1.getSeries().getItem(i).setLegend(java.lang.Integer.toString(i));
for(int j = 0; j < 20; j++)
chart1.getValue().setItem(i, j, ((java.lang.Math.sin((i * 2 * 3.1416) / 19) * java.lang.Math.cos(((j + 5) * 2 * 3.1416) / 19)) * 100));
} chart1.closeData(COD.VALUES);
//3D Settingschart1.setView3DDepth((short) 60);
chart1.setAngleX((
short) 20);chart1.setAngleY((short) 35);
chart1.setView3D(
true);chart1.setChart3D(true);chart1.setGallery(Gallery.SURFACE);
//General Cosmetic Settings for Gallery type, Colors
SeriesAttributes series = chart1.getSeries().getItem(0); series.setColor(new java.awt.Color(15, 213, 239));
series.setAlternateColor(
new java.awt.Color(1, 128, 1));series.setBorderEffect(BorderEffect.DARK);
chart1.getUserLegendBoxObj().setAutoContourLabels(true);
//You should use SetContourLabels to specify the range of values to appear on the user legend
//Make sure that you set this property after you have passed your data and set your colors
Surface mySurface = (Surface) chart1.getGalleryObj(); mySurface.setShowBorders(true);
chart1.setImgMap(ImgMap.TITLE_TIP);
chart1.setSmoothFlags(SmoothFlags.
FILL | SmoothFlags.BORDER);dealchart = chart1;
}
catch (Exception e) {
e.printStackTrace();
} System.out.println(dealchart.getHtmlTag());return dealchart.getHtmlTag();
}
No matter what i do the response by this methos is always "IMAGE" . I am not really sure where should where to locate the temp folder where the image is supposed to be stored. I am using a .ear application . The image is not being created. What it is wrong ?