Cometd、jquery 和数据库
我想用 cometd 和 jquery 从数据库检索数据!我可以建立连接并进行握手,但我无法理解如何向从数据库检索数据的页面发送调用。你有什么想法吗?
I would to retrieve data from DB with cometd and jquery! I can established a connection and making handshake, but I can't understand how to send a calling to a page that retrieve my data from DB. Have you any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Cometd 和 jquery 不提供数据库访问。cometD 只是脚本编写,您必须建立数据库连接并获取数据并使用 jquery cometDpublish() 函数。这就是获取数据并将其放入您制作的频道中。就是这样。
如果您有任何疑问,请访问 www.cometd.org
Cometd and jquery don't provide database access.cometD is just scripting and you have to make db connection and getting data and putting on jquery cometD publish() function. That is takes data and put on channel that u make. That's it.
If you have any query then go to www.cometd.org
Cometd 和 jquery 本身不提供数据库访问。你需要做的是在服务器端开发一个数据库层(如果你用java开发服务器端,则使用JPA)。然后您需要将 cometd 代码(服务器端)插入到数据库层。
在客户端,cometdb 将接收您将使用 jquery 在网页中提供的消息。
cometd 网站上有一些示例,
Cometd and jquery don't provide database access by themselves. What you need to do is developping a db layer on server side (using JPA if you develop server side in java). Then you need to plug your cometd code (server side) to your db layer.
On the client side, cometdb will receive messages that you will feed in your web pages with jquery for example.
You have some examples on the cometd web site,
正如 @unludo 已经提到的,CometD 和 jQuery 本身并不意味着提供任何数据库访问功能。您必须自己在服务器端实现它。
在这里查看 CometD Primer
http://cometd.org/documentation/howtos/primer
Maven 原型“cometd-archetype- jquery-jetty7”将使用 CometD/Jetty + jQuery 生成一个 Maven 项目,您可以使用“mvn jetty:run”立即运行该项目。
生成的项目使用 Spring 框架,因此您可以轻松地利用 Spring 提供的数据访问抽象来实现您的数据库访问需求。
看看
http://static .springsource.org/spring/docs/3.0.x/spring-framework-reference/html/spring-data-tier.html
祝你好运!
As @unludo already mentioned, CometD and jQuery themselves are not meant to provide any DB access functionality. You will have to implement that on the server-side yourself.
Have a look at the CometD Primer here
http://cometd.org/documentation/howtos/primer
The Maven archetype "cometd-archetype-jquery-jetty7" will generate a Maven project with CometD/Jetty + jQuery that you can immediately run with "mvn jetty:run".
The generated project uses the Spring Framework and therefore you can easily leverage the data access abstractions provided by Spring to implement your DB access requirements.
Have a look at
http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/spring-data-tier.html
Good luck!