Thank VizGuy. I have gotten around the problem by forcing a page reload when the form button triggering the request is pressed. Before, I was doing an explicit GET.
On Feb 12, 7:37 pm, VizGuy <[email protected]> wrote: > Hi, > > I need some more info to diagnose the problem, but my first guess would be > that it's something to do with the servlet and JSPs and not with the Google > Visualization API. > What you could try is: > 1. Access the data source url (http://localhost:8080/myApp/....) yourself in > the browser window, without the javascript api, and see that it returns the > right response (google.visualization.setResponse(...)). While you do that, > look at the server logs and see if it was accessed once or twice. > 2. Then try without JSP, to have a static html page with a single > google.visualization.Query access this same url, and look at the server logs > again. > > These two experiments might give you a better hint as to what's going on. > > Regards, > VizGuy > > On Wed, Feb 11, 2009 at 1:42 PM, MartinOShea <[email protected]> wrote: > > > Hello > > > I'm a newbie with Google Vis API and amn currently evaluating it and I > > have a curious anomaly which I can't work out. I wonder if anyone can > > give advice? > > > My JSP has code as follows: > > > var query = new google.visualization.Query( > > 'http://localhost:8080/myApp/googleVisAPI?tqx=version: > > 0.5;reqId:0;sig:5277771;'); > > // Apply query language. > > query.setQuery('SQL string'); > > > and so on. > > > And on the server, I currently have hardcoded: > > > protected void doGet(HttpServletRequest request, HttpServletResponse > > response) throws ServletException, IOException { > > PrintWriter out = response.getWriter(); > > System.out.println("Some text"); > > out.println("google.visualization.Query.setResponse > > ({version:'0.5',reqId:'0',sig:'5277771',status:'ok',table:{cols: > > [{id:'Col1',label:'',type:'number'},{id:'Col2',label:'',type:'number'}, > > {id:'Col3',label:'',type:'number'}],rows:[{c:[{v:1.0,f:'1'},{v: > > 2.0,f:'2'},{v:3.0,f:'3'}]},{c:[{v:2.0,f:'2'},{v:3.0,f:'3'},{v: > > 4.0,f:'4'}]},{c:[{v:15.0,f:'3'},{v:4.0,f:'4'},{v:12.0,f:'5'}]},{c:[{v: > > 1.0,f:'1'},{v:2.0,f:'2'},{v:8.0,f:'3'}]}]}});"); > > System.out.println("More text"); > > > } > > > When the JSP is called, the data is passed from the servlet to JSP and > > the graph is displayed. But the servlet appears to run twice, and I > > see "Some text" and "more text" displayed twice in the server's > > output. > > > This also happens when the reqId and sig parameters are omitted. > > > Does anyone know why this is? > > > Martin O'Shea. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en -~----------~----~----~----~------~----~------~--~---
