How to show Realtime/Streaming Graph on Jsp page - java

How can I plot realtime data with JQuery, Ajax?
The data will be fetched from MySQL/SQL database. I want to show this realtime graph on a JSP page.

My suggestion is to use CanvasJS. It really helps you for easiest and dynamic data plotting.
Checkout JSP Demo Gallery
Check this page for an chart rendered from JSON file using AJAX request.

Related

How can I reload only a part of code - Java

I have a JSP page that at the end comes a pop-up window from a javascript, I want after the users click to reload only a specific part of the JSP page more specific one if - loop want to be reloaded one more time ...can this happened or the idea is totally wrong ?
What you are looking for is called AJAX.
AJAX is the art of exchanging data with a server, and updating parts
of a web page - without reloading the whole page.
jQuery has a very nice ajax api.
To load html pages, you could use jQuery.load like this:
$("#result").load( "ajax/test.html" );
You can also generate dynamic html by calling a REST function of a php page using a different url. Example:
var data = { limit: 25, otherProp: "val" }
$("#result").load( "getHtmldata.php", data);

Change HTML Tags from fetched data with JavaScript?

I am trying to change HTML tags from Data I'm fetching with an API. I am at a point that the text from the API is being displayed on the page but this text includes header tags that I would like to make a different header. For example to an . I have tried to use:
function(){
$('p').replaceWith('divs rule!');
});
but this applies to the whole page. Is this possible?
You can replace the data at retrieval time:
.done(function (html) {
$(html).find("p").replaceWith("divs rule!");
});

I am using to jsoup to pull images from website url, but I want the page to load first is there anyway to do this?

The problem is that some of the urls I am trying to pull from have javascript slideshow containers that haven't loaded yet. I want to get the images in the slideshow but since this hasn't loaded yet it doesn't grab the element. Is there anyway to do this? This is what I have so far
Document doc = Jsoup.connect("http://news.nationalgeographic.com/news/2013/03/pictures/130316-gastric-brooding-frog-animals-weird-science-extinction-tedx/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+ng%2FNews%2FNews_Main+%28National+Geographic+News+-+Main%29").get();
Elements jpg = doc.select("img[src$=.jpg]");
jsoup can't handle javascript, but you can use an additional library for this:
Parse JavaScript with jsoup
Trying to parse html hidden by javascript

Showing fresh data in table (jsp page) after ajax call in pop-up window (Extjs) to update

I'm trying to figure out how to update the data that shows on screen after doing an Ajax call to update this data. I am using Struts2 and the table that shows the data is included via an s:include tag.
I have a update button on the page that opens a new Extjs Window in which I can make an Ajax call to the database to update the data that I have displayed on the table in the jsp.
It seems that the database can update correctly, and that the data object for the page is updated where, if I refresed the page I would see the new data. My problem is that I want to see the new data in the table without having to refresh the page - to reflect the Ajax call.

jQuery dilemma in loading different pages on one page

Hello i need some help to figure out what to do .
I am trying to create a page that has a list of events and each time I click one of the list's elements a different photo gallery should load. I did this by loading each gallery in a different iframe.
The problem is that right now the only thing it dose is loading the first galery and the other ones don't seem to manage loading any pictures (if I refresh each frame than they work fine)
What should i do?
This is the script I used in the webpage
You can find the page source here http://www.avantsolutions.ro/exp.txt
You can try with jQuery UI Plugin instead of iFrame.
On clicking of list item(West pane), you can load center pane div with corresponding images.
Check the examples here.
You can use jQuery's load function to load a gallery via ajax.
$(selectorForYourGalleryDisplayDiv).load( url, [ data ], [ complete(responseText, textStatus, XMLHttpRequest) ] )
Load will take the result from url, if you need to pass it data it will use a HTTP POST, and replace the inner html of the wrapped set it is called on.
I don't know the internals of your architecture, but the main process is giving your galleries Ids, pass them to the server using the JSON format, your code will use that id to get what's needed for the gallery, render the html and return it.
load will drop that html into the elements that match selectorForYourGalleryDisplayDiv.

Categories

Resources