I have a page that is displaying a SVG rendered chart and I am trying to convert that chart into an image for the user to download. I am using struts for the download action and a separate servlet for actually converting the SVG elements into an image (not sure if this is the best approach). Since there is so much information (tags and attributes) required for the SVG chart I decided to use AJAX to send smaller pieces of info back to the servlet in order to avoid an 'out of memory' error. My question is this, is it possible to have the AJAX function send the info to the download action instead of the servlet? I am using the Struts HTML tags for my form and I am not sure of how to write the URL for the AJAX request in order for it to go to the action. I ask because the download action usually gets executed before the file conversion is complete. Thanks,
There's no difference between an Ajax request to an action and an Ajax request to a servlet (or whatever).
That said, I'm surprised you'd get an OOM error--if there are *that* many form/etc. elements on the page maybe it'd be best to get them the same way you got them when you displayed the JSP in the first place and avoid such a massive submit.
I agree, what you said would be the easiest way of doing things, but I am using Dojo to create the chart and not sure if it is possible to get the data without it first being displayed. I thought I tried using the same call for the request in ajax and got an error, but maybe I mistyped something. I'll try again thanks.