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 8541557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:51:35+00:00 2026-06-11T11:51:35+00:00

I am using Spring MVC , example.jsp file with Javascript. I have been stuck

  • 0

I am using Spring MVC , example.jsp file with Javascript.
I have been stuck on this for a long time.

Is it possible to use Javascript to laod new data from DB into HTML tables without refreshing the whole page?

I just don’t want my whole page being replaced when new data is loaded into table with some event.

  • 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-06-11T11:51:36+00:00Added an answer on June 11, 2026 at 11:51 am

    If you want to reload a part of you page using JavaScript, basically AJAX.
    This is how you should do it.

    Client Side

    Let’s assume that you’re using jQuery as a JavaScript Framework.
    You’ll need to use jQuery.ajax() in the Client Side.

    var successHandler = function( data, textStatus, jqXHR ) {
      // After success reload table with JavaScript
      // based on data...
    };
    
    var errorHandler = function( jqXHR, textStatus, errorThrown ) {
      // Error handler. AJAX request failed.
      // 404 or KO from server...
      alert('Something bad happened while reloading the table.');
    };
    
    var reloadData = function() { 
      // Process your request
      var request = new Object();
      request.id = 'some id'; // some data
    
      // Make the AJAX call
      jQuery.ajax({
        type       : 'POST',
        url        : 'http://domain/context/reload-data-url',
        contentType: 'application/json',
        data       : JSON.stringify(request)
        success    : successHandler,
        error      : errorHandler
      });
    };
    

    Call the reloadData() function when you need to reload the table.

    Server Side

    You’re using Spring MVC. Then your Controller should look like:

     // Spring MVC Controller
     @Controller
     public class ReloadDataController {
    
       // Request Mapping
       @RequestMapping(value = '/reload-data-url', method = RequestMethod.POST)
       @ResponseBody
       public ResponseEntity<String> processReloadData(@RequestBody String body) {
    
         // Get your request
         JSONObject request = new JSONObject(body);
         String id = request.getString("id"); // Here the value is 'some id'
    
         // Get the new data in a JSONObject
         JSONObject response = new JSONObject();
         // build the response...
    
         // Send the response back to your client
         HttpHeaders headers = new HttpHeaders();
         headers.add("Content-Type", "application/json; charset=utf-8");
         return new ResponseEntity<String>(response.toString(),
                    headers, HttpStatus.OK);
       }
    
     }
    

    You don’t have to use JSON but I think this is the best way.
    Hope this will help you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is an example of using ThrowawayController in Spring MVC: public class DisplayCourseController implements
I'm trying to make this 2-player web game application using Spring MVC. I have
I am using spring mvc 3.0,jsp,mysql. I have table tbl_employee and it's attributes are
Using Spring MVC, I have this Controller class: @Controller public class LoginController { @Autowired
I'm using Spring MVC and my jsp's have a <div id=debug> section that I
I am using spring mvc in my application,when i created user i have to
I'm using Spring MVC and jquery autocomplete, my spring controller looks like this @RequestMapping(value
I'm using spring MVC, and I have a custom authentication/security system that I had
I'm creating a web application using spring mvc. I have started to incorporate the
In Spring MVC I can access my beans in JSP using JstlView's exposedContextBeanNames (or

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.