Hi David,

what I am doing is a different approach with the same effect. I am
storing the Image on Disc, and then just pass the filename, or the
object which can provide the filename to the screen class. 

It does not matter if you create the chart inside the screen class or
the action, as a matter of fact, I think that you should place the image
generation code inside the screen, as it belongs there. 

But for your action generated image, i think i know where your problem
lies.

instead of using:

<img src="$link.setPage("Chart.vm")"/>

you should use:

<img
src="$link.setPage("Chart.vm").setAction("ImageCreationAction").addQueryData("eventSubmit_doCreategraph","1")"/>

Because I think your Action never gets called. In my case I called the
action when I created the Image surrounding screen which contained all
the image links.

Could I explain this correctly?

Kind regards

J�rgen Hoffmann

Am Do, den 20.05.2004 schrieb David A. Harris (DAH) um 0:50:

> Howdy J�rgen,
> 
>  
> 
> Well I found my problem, it has to do with the code in the Action
> method 
> 
>  
> 
>             // A complete hack for testing purposes
> 
>            JFreeChart chart = createGraph();
> 
>             System.out.println("Should have created a chart");
> 
>             data.getUser().setTemp("chart", chart); 
> 
>       
> 
>             When my screen class goes to retrieve the chart, it pulls
> out a great big NULL.
> 
>             After a lot of reading and printfs sprinkled all over I
> moved all the graph creation code into the screen class.
> 
>  
> 
>             That's when I saw that the
> 
>  
> 
> <img src="$link.setPage("Graph.vm")"  
> 
>  
> 
> line works as advertised, reguardless of what the Web page source
> says.  There was a nice lil graph in the middle of 
> 
> my web page.   I assume that there is something about the action
> class.  The one I am tacking code into
> 
> extends SecureAction.
> 
>  
> 
> I guess I will spend tomorrow playing around with setTemp() methods.
> 
> Do you know if the objects I place into the session have to be
> serializable ?
> 
>  
> 
>  
> 
> Dave Harris
> 
>  
> 
>  
> 
>  
> 
> -----Original Message-----
> From: J�rgen Hoffmann [mailto:[EMAIL PROTECTED] 
> Sent: Monday, May 17, 2004 10:39 AM
> To: David A. Harris (DAH)
> Subject: Re: AW: communication between turbine servlets and JFreeChart
> 
>  
> 
> Hi David,
> 
> this is just a screen class which extends RawScreen as in my example.
> Since I am taking the HttpOutputStream there and wirte to it and close
> it, there is no template which has to be parsed...
> 
> I have commented my source below:
> 
> /* Extend RawScreen, so we can write directly to the Servlets
> OutputStream */
> public class ArchiveImage extends RawScreen
> {
> 
>     /* return the Content type of this page so the browser knows what
> is coming */
>     protected String getContentType(RunData data)
>     {
>         return "image/jpeg";
>     }
> 
>     protected void doOutput(RunData data) throws Exception
>     {
>         /* 
>             Get all the necessary Data to display the screen.
>             The Path to the Image (which is stored on the filesystem
> rather than the db) is stored inside the db
>         */
>         AccountingArchive record =
> AccountingArchivePeer.retrieveByPK(data.getParameters().getInt("id"));
> 
>         /* Now that we have the record open the image and get an
> inputstream for it */
>         FileInputStream in = new FileInputStream(Archiver.IMAGE_PATH +
> "/" + record.getImagePath());
> 
>         /* Create a new ByteBuffer for Reading the Content */
>         byte[] b = new byte[2048];
>         
>         /* Get The OutputStream for this screen */
>         OutputStream out = data.getResponse().getOutputStream();
>         
>         /* While we can read Data into the Buffer print it on the
> OutputStream of the Screen */
>         while (in.read(b) > -1)
>         {
>             out.write(b);
>         }
> 
>         /* Finally Flush the Stream */
>         out.flush();
>     }
> 
> }
> 
> HTH
> 
> J�rgen Hoffmann
> 
> Am Mo, den 17.05.2004 schrieb David Harris um 16:20: 
> 
> 
> J�rgen,
>  
> If Image.vm does not exist then what is going in the Velocity template 
> file that contains the following line?
>  
> <img src="$link.setPage("mrtg,Image.vm")" border="0"/>
>  
> J�rgen Hoffmann wrote:
> > Hi,
> > 
> > exactly. In fact it doesn't even exist.
> > 
> > Kind regards
> > 
> > J�rgen Hoffmann
> > 
> > 
> > -----Urspr�ngliche Nachricht-----
> > Von: Robles, Rogelio [mailto:[EMAIL PROTECTED] 
> > Gesendet: Samstag, 15. Mai 2004 03:58
> > An: 'Turbine Users List'
> > Betreff: RE: communication between turbine servlets and JFreeChart
> > 
> > 
> > And what do you put inside Image.vm?, 
> > 
> > Should be empty if you just want to force Turbine to load and run your
> > de.byteaction.modules.screens.mrtg.Image class, right?
> > 
> > Thanks,
> > Rogelio
> > 
> > 
> >>-----Original Message-----
> >>From: J�rgen Hoffmann [mailto:[EMAIL PROTECTED] 
> >>Sent: Friday, May 14, 2004 1:11 AM
> >>To: Turbine Users List
> >>Subject: Re: communication between turbine servlets and JFreeChart
> >>
> > 
> > ...
> > 
> >><img src="$link.setPage("mrtg,Image.vm")" border="0"/>
> >>
> >>kind regards 
> >>
> >>J�rgen Hoffmann
> >>
> > 
> > 
> > ---------------------------------------------------------------------
> > 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:40abe55e193081581413799!

Reply via email to