I am working on a project where I access the APIs and get the output using Java. Now I want to display the data using some graphs and other data visualization tools in a browser. I have searched for some JavaScript libraries for that. But how can I connect java and javascript to get the output in a browser.
Can I do it with JSP? I don’t want to use applets. Please suggest other ways also.
EDIT: If I use JSP then I will have to host a server. Is there a direct way without hosting a server?
Yes you can do that with
JSP(java server page). By passing data from Java to javascript in your jsp page. JSP page typically compiled into raw html and send it to client.Simple example of passing value java to javascript in jsp page.
A example of java list values to js variable using jsp scriptlet.
Better use jstl tag library which is easier to write and structured.
JSP documentation
JSP library
JSTL documentation 1
JSTL library