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

  • Home
  • SEARCH
  • 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 7987293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:06:20+00:00 2026-06-04T12:06:20+00:00

I have a JSP page which shows items included in an Array (Just a

  • 0

I have a JSP page which shows items included in an Array (Just a very simple list).
In the background the Array might change i.e. adds a new Item or remove one.

How can I auto refresh the page when the Array changes?

  • 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-04T12:06:21+00:00Added an answer on June 4, 2026 at 12:06 pm

    There are 2 ways that are most popular to perform such operation

    • pool a method that would send 1 or 0 to see if you refresh the page or not
    • keep asking for that data array and populate it through javascript

    Option 1

    • create a .jsp page and call it, for example, updateList.jsp
    • add a single method that will check if there is more data to be filled and output 1 or 0 like: out.println(1)
    • in your page, and using jQuery to simplify things
     $.get("updateList.jsp", function(data) {
        if(data !== null && data.length > 0 && data === 1) {
            // refresh this page
            document.location = document.location.href;
        }
     });
    

    Option 2

    • create a .jsp page and call it, for example, data.jsp
    • add a single method that will output a JSON string containing all data you need to populate the list
    • in your page, and using jQuery and JsRender to simplify things
     $.get("updateList.jsp", function(data) {
        if(data !== null && data.length > 0) {
            $("#my-list").html(
                $("#my-template").render(data);
            );
        }
     });
    

    and in your HTML you will have:

    <ul id="my-list"></ul>
    
    <script id="my-template" type="text/x-jsrender">
        {{for items}}
          <li>{{:name}}</li>
        {{/for}}
    </script>
    

    assuming your JSON would be something like:

    item: [
        { name: "Name A" },
        { name: "Name B" },
        { name: "Name C" },
    ]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I have a page in my java/jsp based web application which shows list
I'm generating a page using jsp, it has a list element which shows a
I have a jsp page which shows the contents of a table. While the
I have a JSP page which display a list from servlet, it has a
I have a JSP page which accepts SQL queries, performs them then returns the
I have a jsp page which needs a java code. This java code inside
I have a JSP page, which accepts user strings in more than 23 languages.
I have a JSP page on which I have a div tag in which
I have a jsp that shows me a list of students from base. For
I have created a jsp page which run fine when executed in tomcat.But when

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.