views:

83

answers:

1

how can i make this entire process as 1 single event???

http://code.google.com/apis/visualization/documentation/dev/dsl_get_started.html

and draw the chart on single click?

I am new to servlets please guide me

When a user clicks the "go " button with some input. The data goes to the servlet say "Test3". The servlet processes the data by the user and generates/feeds the data table dynamically Then I call the html page to draw the chart as shown in the tutorial link above.

The problem is when I call the servlet it gives me a long json string in the browser as given in the tutorials

"google.visualization.Query.setResponse({version:'0.6',status:'ok',sig:'1333639331',table:{cols:[{............................" 

Then when i manually call the html page to draw the chart i am see the chart.

But when I call html page directly using the request dispatcher via the servlet I dont get the result.

This is my code and o/p...... I need sugession as to how should be my approach to call the chart

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");// it call's the html page which draws the chart as per the data added by the servlet.....
         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.add.........

I get the following result along with unprocessed html page

google.visualization.Query.setResponse({version:'0.6',statu.....
<html>
<head>
  <title>Getting Started Example</title>
.... Entire html page as it is on the Browser.

What I need is when a user clicks the go button the servlet should process the data and call the html page to draw the chart....Without the json string appearing on the browser.(all in one user click)

What should be my approach or how should i design this.... there are no error in the code. since when i run the servlet i get the json string on the browser and then when i run the html page manually i get the chart drawn.

So how can I do (servlet processing + html page drawing chart as final result) at one go without the long json string appearing on the browser. There is no problem with the html code....

A: 

I will explain further if the question is not clear

Akku
1.) This should have been a comment or an edit to your question and not an answer2.) The question is not dumb (or more precisely: I can't tell if it is).3.) **What are you asking?** I have trouble understanding what you want to achieve. Please edit your question to include more details. Maybe try to rephrase your goal.
Joachim Sauer
You haven't actually asked a question that is answerable. No one can tell what you want.
Jonathon
And as a general guideline read [How To Ask Questions The Smart Way](http://www.catb.org/~esr/faqs/smart-questions.html)
Joachim Sauer
Sorry for not being precise!!!I will try to re frame my question
Akku