Hi J�rgen,

I really like the un apparent simplicty of your solution. Since I'm new to Turbine, I don't fully understand whats going on in the line:

<img src="$link.setPage("mrtg,Image.vm")" border="0"/>

My limited understanding is that its a Velocity macro that is going to be expanded by the Velocity templating engine. I just don't understand the part of where and who is serving up the Image file.

Could you elaborate a little more as to what's going on there?


Dave Harris


J�rgen Hoffmann wrote:
Hi,

here is a simple example:

package de.byteaction.modules.screens.mrtg;


import org.apache.turbine.modules.screens.RawScreen;


import org.apache.turbine.util.RunData;

import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;

import java.io.OutputStream;

/**
 * @author buddy
 */
public class Image extends RawScreen
{
    /* (non-Javadoc)
     * @see 
org.apache.turbine.modules.screens.RawScreen#getContentType(org.apache.turbine.util.RunData)
     */
    protected String getContentType(RunData data)
    {
        return "image/jpeg";
    }

    /* (non-Javadoc)
     * @see 
org.apache.turbine.modules.screens.RawScreen#doOutput(org.apache.turbine.util.RunData)
     */
    protected void doOutput(RunData data) throws Exception
    {
        JFreeChart   chart = (JFreeChart) data.getSession().getAttribute("chart");
        OutputStream out = data.getResponse().getOutputStream();

        ChartUtilities.writeChartAsJPEG(out, chart, 800, 400);
        out.flush();
    }
}

I have build the chart inside my action and put it into the users Session. You could do that 
using data.getUser().setTemp("image"),JFreeChart) also.
Then I have setup the screen like this. Now I can reference the screen in my image tags

<img src="$link.setPage("mrtg,Image.vm")" border="0"/>

kind regards

J�rgen Hoffmann


Am Fr, den 14.05.2004 schrieb Pradeep Kumar um 5:38:



Hi,

This is my first mail to list...if my suggestions are too obvious
please ignore them.

we are developing some application using turbine and we have used jfree
chart.
addition to info you are passing we are passing
<.......pluginspage="http://www.adobe.com/svg/viewer/install/";
type="image/svg+xml" src=...." />.
How you are sending image info.....type depends on that.

I hope this will work for you.

Thanks,
Pradeep Kumar Chaturvedi


[EMAIL PROTECTED] 5/14/2004 1:09:24 AM >>>

Hello list,



I'm intergrating JFreeChart into a Turbine application. The JFreeChart


folks have a suggested way of streaming a PNG graphic, such that you
can serve up a dynamic graphic by referenceing your graphic generating servlet within a image tag... <img src=\"ChartGenerator?type=" + param
+ "/>


My problem is I need to pass more information than what could be passed

in URL parameters. Does anyone have suggestions as to how I could accomplish this?




Dave Harris



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


!EXCUBATOR:40a43f36228042086255552!







--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to