How can I use JSP, JavaScript/jQuery and spring-jdbc to display tooltip text from database-mysql on mouseover
.

- 5,753
- 72
- 57
- 129

- 1
- 2
-
What did you try? – Jeroen Heier Oct 03 '16 at 04:19
1 Answers
You are going to want to preload the tooltip texts on page load so you don't have to send a request right when the user hovers over the element.
- first things first you are going to want to create a db table that contains the tooltip strings.
- next you are going to want to get the values from the DB using spring/jdbc. Here is a link describing how to do that.
next you are going to want to set up a gateway that serves up the information found above, so that your front end can grab the tooltip strings. To make this happen you are most likely going to need a java class "tooltip," which you use to wrap the tooltip strings and send back when the tooltips endpoint has been hit
next, in the front end you are going to want to process the tooltip string data you got back. If you are going to be reusing the same tooltip text for many elements then I would recommend giving each tooltip a name. You will want to use that name to store the tooltip text on the FE in a global location so that every page/component of your app will be able to access the tooltips.
Now you have the tooltip text in the front end and you can add a html element help you display your tooltip. Here is a link for reference - How do I add a tool tip to a span element?
Good luck!!