Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7071427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:41:11+00:00 2026-05-28T05:41:11+00:00

I want to push the data to the jsp for every 2 seconds, with

  • 0

I want to push the data to the jsp for every 2 seconds, with out client requesting it.
I am using Spring with Hibernate here.
I am displaying google maps marker, and I want to update the marker location for every 2 seconds by getting the data from database, however I have done getting the data from database for every 2 seconds, but I am unable to push that data to this jsp.

   @Scheduled(fixedRate = 2000)
   public void getData(){
                    // TODO Auto-generated method stub
                    DeviceDetails deviceDetails = realTimeDataDAO.getDeviceDetails(deviceId);
                    System.out.println(deviceDetails);
                }

I have to display some data after every 2 seconds. Can anyone tell me how to do that?

any one knows about Comet Ajax Push technology, will it work in this scenario?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:41:12+00:00Added an answer on May 28, 2026 at 5:41 am

    Your best bet with Spring is to store the results of the scheduled query into a bean in memory, then have another request-scope bean get that stored result in a method that is web accessible, and return it as text (or JSON). Alternatively you could query the DB everytime an update is requested.

    Then, you can make a timed async request from your page (You may want to use YUI Connection Manager for that), read the response and use the panTo method from google.maps.Map to update your map location.

    As you can see, the solution is split in a Java and a JavaScript portion.

    For the Java side, you must create a controller that performs the query to the database (or better yet, delegates that task to another layer) and returns the results as JSON, you can use http://spring-json.sourceforge.net/ for that. It’s a bit complex in Spring so you might want to instead create a simple servlet that returns the data.

    For the Javascript side, once you have a working endpoint that returns the JSON data, using YUI Connection Manager and the google maps api:

    function update(){
        var callback = {
            success: function (o) {
                var response = YAHOO.lang.JSON.parse(o.responseText);
                map.panTo({lat: response.lat, lng: response.longi}); // map is the google.maps.Map representing your map
            },
            failure: function (o) {
    
            }
        }
        var sUrl = '/getData.htm'; // This is the request mapping for your bean
        YAHOO.util.Connect.asyncRequest('GET', sUrl,callback);
    }
    
    function init(){
        setTimeout("update()", 2000);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Read about Server push here . I want to push data to client from
I want to use XMPP to push data to my client which would translate
Howday, I want to push data to flex clients. I am talking about anywhere
Suppose I have div and I want to fetch data and push data into
i want to push data to user browser if an event happens on browser.
We want to push data from a server to clients but can only use
I want to push all data from SourceTable to TargetTable by inserting or updating
When I have loaded new data onto my server, I want to push a
I want to push data to the browser over HTTP without killing my django/python
I am using BlazeDS for data-push feature in my Flex application project. From the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.