开发者

Need a design approach or suggestion for a simple structure using Servlet

开发者 https://www.devze.com 2023-01-03 03:30 出处:网络
I have to design such that whenever user pass a query I process it using servlet and then call the js page to draw the chart

I have to design such that whenever user pass a query I process it using servlet and then call the js page to draw the chart

1> user writes a query on a page 2> the page call the servelt class public class MyServlet extends Httpservlet implements DataSourceServlet {..... return data The user see a beautiful string like this.. google.visualization.Query.setResponse......... /Tiger'},{v:80.0}, {v:false}]}]}}); 3> when the user hits on different html page myhtml.js it draws the chart.

I want the Myservlet class itself call the myhtml.js page and draw the chart directly. and want to eliminate the beautiful string google.visualization.Query.setResponse......... /Tiger'},{v:80.0}, {v:false}]}]}}); from coming on user's browser What should i 开发者_JS百科do? I tried using functions to call another page like request dispatcher(), redirect() calling myhtml.js page directly after myservlet process the query results. But i get the result like this google.visualization.Query.setResponse......... /Tiger'},{v:80.0}, {v:false}]}]}}); and the entire myhtml.js code page below it on the browsers that to without the chart been draw.

Is there anyway to element the beautiful string from coming on clients browser and only show them the chart been drawn ? :)

This is the small tutorial i am following http://code.google.com/apis/visualization/documentation/dev/dsl_get_started.html


It is a bit difficult to follow, but I think you approach the problem from the wrong side.

As HTTP is essentially a PULL technology it is much easier to have the HTML page call the myhtml.js functionality and request the data from the servlet.

Calling browserside JavaScript from servlets is not really possible without considerable infrastructure which is probably not what you want, i.e. a lean/simple solution.

0

精彩评论

暂无评论...
验证码 换一张
取 消