简体   繁体   English

直接使用javascript从MYSQL获取所有数据库值

[英]getting all database values from MYSQL directly using javascript

so here is my question i want to get all my database values from MYSQL using javascript.. as i am researching it in google it is possible but i don't know if it needs a configuration because i am using a spring hibernate in maven here is the link that i found How to get data from database in javascript based on the value passed to the function 所以这是我的问题,我想使用javascript ..从MYSQL中获取我所有的数据库值。因为我正在google中研究它,这是可能的,但是我不知道它是否需要配置,因为我在这里在maven中使用spring hibernate。是我找到的链接, 如何根据传递给函数的值从javascript中的数据库中获取数据

i am trying to get the values from my database because i am doing a highchart for my website.. thank you very much in advance.. 我正在尝试从数据库中获取值,因为我正在为我的网站做一个图表,..非常感谢。

if there are any possible ways to do it please comment also thank you again 如果有任何可能的方法,请发表评论并再次感谢您

You are already using Spring and Hibernate, so you need to implement a REST GET service to fetch the data you need and then simply feed it to your java script component. 您已经在使用Spring和Hibernate,因此您需要实现REST GET服务来获取所需的数据,然后将其简单地馈送到Java脚本组件中。

So it goes like this: 所以它是这样的:

  1. The browser makes an AJAX request to the REST service 浏览器向REST服务发出AJAX请求
  2. The REST service calls the Spring service which calls the DAO component REST服务调用Spring服务,后者调用DAO组件
  3. The DAO component fetches the required data (entities/DTO projections) DAO组件获取所需的数据(实体/ DTO投影)
  4. Configure the Spring MVC REST controller to Use Jackson for serializing the entities/DTO projections to JSON 配置Spring MVC REST控制器以使用Jackson将实体/ DTO投影序列化为JSON
  5. The ajax call response handler can simply use the JSON provided by the server to feed highcharts Ajax调用响应处理程序可以简单地使用服务器提供的JSON来填充图表

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM