Makes sense. I was hoping to do dashboard type implementation with
Jfreecharts where the ajax call to get the new chart  based on a timer thats
why I did not want to persist the chart somewhere.


Frank W. Zammetti wrote:
> 
> In general with AJAX this isn't possible... there's no way at present to
> insert binary data, be it an image, PDF, whatever, into the page, and have
> the browser render it.
> 
> What you would have to do is return HTML instead, which includes an  
> tag pointing to the image on the server, which in this case would be your
> chart, written out somewhere with some ID.  For instance, you might write
> it to a database, using some unique identifier for the user as a key, and
> then your   tag points to an Action, with the ID as a query string,
> that retrieves the image from the database based on the ID.
> 
> So it would go something like:
> 
> User clicks generate chart button --> Server generates chart, writes to DB
> ---> Return HTML like  getChart.action?id=1234  --> HTML
> inserted into page, browser requests getChart.action to get image, which
> is an Action, not an image --> Action retrieves image from DB and returns
> it --> Chart displayed
> 
> Frank
> 
> -- 
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> AIM/Yahoo: fzammetti
> MSN: [EMAIL PROTECTED]
> Author of "Practical Ajax Projects With Java Technology"
>  (2006, Apress, ISBN 1-59059-695-1)
> and "JavaScript, DOM Scripting and Ajax Projects"
>  (2007, Apress, ISBN 1-59059-816-4)
> Java Web Parts - http://javawebparts.sourceforge.net
>  Supplying the wheel, so you don't have to reinvent it!
> 
> On Fri, July 13, 2007 9:54 am, travers wrote:
>>
>> Hi is it possible to specify href in <s:div to render content as an image
>> ?
>> I have a struts2 action returning a JfreeChart chart as png.
>>
>> Without ajax, <image src="/chart/ViewChart.action"/> shows the chart
>> correctly, but the following renders it as text (well actually the binary
>> stuff inside the png)
>>
>> <s:url id="ajaxCallUrl" value="/chart/ViewChart.action"/>
>>      <s:div theme="ajax"
>>            href="%{ajaxCallUrl}" loadingText="Loading Chart...">
>>      </s:div>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Rendering-an-image-into-%3Cs%3Adiv-from-ajax-tf4074632.html#a11580059
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Rendering-an-image-into-%3Cs%3Adiv-from-ajax-tf4074632.html#a11580993
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to