需要使用 Servlet 的简单结构的设计方法或建议

发布于 2024-09-06 04:30:08 字数 942 浏览 0 评论 0原文

我必须进行设计,以便每当用户传递查询时我都会处理它 使用servlet然后调用js页面绘制图表

1>用户在页面上写入查询 2>页面调用servet类 公共类 MyServlet 扩展 Httpservlet 实现 DataSourceServlet {.....返回数据 用户看到这样一个漂亮的字符串.. google.visualization.Query.setResponse......... /Tiger'},{v:80.0}, {v:假}]}]}}); 3>当用户点击不同的 html 页面 myhtml.js 时,它会绘制 图表。

我希望 Myservlet 类本身调用 myhtml.js 页面并绘制 直接上图表。 想要消除美丽的弦 google.visualization.Query.setResponse......... /Tiger'},{v:80.0}, {v:假}]}]}}); 来自用户浏览器 我应该怎么办? 我尝试使用函数来调用另一个页面,例如请求 Dispatcher()、redirect() 之后直接调用 myhtml.js 页面 myservlet 处理查询结果。 但我得到这样的结果 google.visualization.Query.setResponse......... /Tiger'},{v:80.0}, {v:假}]}]}}); 以及浏览器上其下方的整个 myhtml.js 代码页 没有绘制图表。

无论如何,有没有办法把漂亮的绳子从客户身上摘下来 浏览器 并且只向他们展示绘制的图表? :)

这是我正在遵循的小教程 http://code.google.com/apis/visualization/documentation/ dev/dsl_get_started.html

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

微凉 2024-09-13 04:30:08

这有点难以理解,但我认为你从错误的角度解决了这个问题。

由于 HTTP 本质上是一种 PULL 技术,因此让 HTML 页面调用 myhtml.js 功能并从 servlet 请求数据要容易得多。

如果没有大量的基础设施,从 servlet 调用浏览器端 JavaScript 是不可能的,这可能不是您想要的,即精益/简单的解决方案。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文