How to pass data from java backend to html page?
in my backend i use java and i need to display google chart in html page. im using a tool to generate a url by retrieving the data, do some calculation and create a url to retrieve an image for this chart. my question is how开发者_开发知识库 could i pass this url to the html page (portlet) from java to this page.
you would use ajax to invoke the server and request the url. The server does its thing and sends the url back in the response. You would then use javascript to update the dom (i.e. html) on the page.
I recommend using a framework like jquery to make the ajax request and update the DOM. Plenty of examples are online.
use servlet or JSP you can set the response to send values you want.
AJAX use httpRequestXML to send request and can have a callback function to have response
精彩评论