Thanks Badtnik,
Can you explain me a bit more please..... i have idea of servlet a bit
but I donno Ajax
Here is what i was doing
When the user clicks "go" i retive some data from it and feed to to
servlet to add the data in the DataTable generateDataTable(Query
query, HttpServletRequest request)

public class Test3 extends HttpServlet implements DataTableGenerator
{......

and call     DataSourceHelper.executeDataSourceServletFlow(request,
response,  this , isRestrictedAccessMode() );

I noticed that i cant use out.println in this..... it gives me
internal thread exception..... so i didn't used Printer out obj;
The long json string gets created and seen in browser.
I render further using dispatcher to call the html page through the
servlet ......

The Final output that i get on browser in

google.visualization.Query.setResponse({version:'0.6',status:'ok',sig:'1333639331',tab....................
and the entire html code that draws the chart...as it is.....on the
browser
<html>
<head>
  <title>Getting Started Example</title>
  <!--Load the AJAX API-->
  <script type="text/javascript" src="http://www.google.com/jsapi";></
script>
  <script type="text/javascript">

  //Load the Visualization API and the ready-made Google table
visualization
  google.load('visualization', '1', {'packages':
['table']});...................................................................................


This is my code...... when a user hits go
public class Test3 extends HttpServlet implements DataTableGenerator {
  protected void processRequest(HttpServletRequest request,
HttpServletResponse response)
    throws ServletException, IOException {
 DataSourceHelper.executeDataSourceServletFlow(request, response,
this , isRestrictedAccessMode() );


            RequestDispatcher rd;
             rd = request.getRequestDispatcher("new.html");
             rd.include(request, response);//forward(request, response);

  @Override
  public Capabilities getCapabilities() {
    return Capabilities.NONE;
  }


protected boolean isRestrictedAccessMode() {
    return false;
  }

 @Override
  public DataTable generateDataTable(Query query, HttpServletRequest
request) {
    // Create a data table.
    DataTable data = new DataTable();
    ArrayList<ColumnDescription> cd = new
ArrayList<ColumnDescription>();
    cd.add(new ColumnDescription("name", ValueType.TEXT, "Animal
name"));
    cd............................................  ... ...

What should be the approach ??? Or am I doing anything wrong?
The chart draws fine when after running the servlet and getting the
json string on browser . i run the html code manually.

Actually I am taking the data for visualization dynamically so i need
servlet to process it and then call the html page......
A sample code will also be of great help for me.
thanks & regards,
Akku




On Jun 11, 10:55 am, Oded Badt <[email protected]> wrote:
> Hello Akku
>
> There are generally two approaches to solving such a requirement.
> The first is having the "Go" button submit a form whose response is a server
> side html that is rendered to show a chart
> The other is sending an AJAX call and having client javascript code
> responding to that call draw the chart
>
> What flavor do you prefer?
>
>   Badtnik
>
> On Fri, Jun 11, 2010 at 5:42 PM, Akku <[email protected]> wrote:
> > Hi friends,
> >  I get the same old json string using DataSourceHelper too.
> > Please anyone guide me how to process data using a servlet and showing
> > the chart in a "single event".
> > I used Requestdispatcher but that seems to be a bad idea.
> > I used DataSourceHelper.executeDataSourceServletFlow method too, but
> > get json string on the browser
> > I am trying to built a website and when the user clicks "go " button
> > the data should be processed by the servlet and chart should be drawn
> > by the html code
> > i am following this tutorial
> >http://code.google.com/apis/visualization/documentation/dev/dsl_get_s...
> > need a design suggesion!!!!
> > Need guidance as to how should i go about it.
> > I get proper results when i follow the tutorial step by step but donno
> > how to integrate it.
> > regards
> > Akku
>
> > --
> > 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]<google-visualization-api%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-visualization-api?hl=en.

-- 
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.

Reply via email to