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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:38:17+00:00 2026-05-16T23:38:17+00:00

I have written a servlet java program. During the execution of one particular loop

  • 0

I have written a servlet java program.

During the execution of one particular loop of the program, I need the a gif file to be displayed in the JSP form indicating that the process is going on.

I am not aware of implementing the same inside the loop.

Kindly advise on how the same has to be done, such that a gif file is displayed in the JSP form and it would be of great use if u can suggest any .gif file for the purpose of processing display. Am a beginner in java.

Thanks in advance

  • 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-16T23:38:17+00:00Added an answer on May 16, 2026 at 11:38 pm

    JSP is supposed to output HTML. Images in HTML are to be displayed using <img> tag. This tag has a src attribute which is supposed to point to a public web resource. Here’s an example:

    <img src="progress.gif">
    

    When opening the JSP page by http://example.com/context/page, this assumes the progress.gif file to be present in http://example.com/context/progress.gif (i.e. in the root of the public webcontent folder).

    Now, you want to display the image only when the submit button is pressed in order to wait for the response to be finished. You can do this by initially hiding the image using CSS and redisplaying it using JavaScript.

    HTML:

    <input type="submit" onclick="showProgress()">
    <img id="progress" src="progress.gif">
    

    CSS:

    #progress { 
        display: none;
    }
    

    JavaScript

    function showProgress() {
        document.getElementById('progress').style.display = 'block';
    }
    

    When the response is finished, it will refresh the page with the new target page and the progress image will “automatically” disappear.


    Update: here’s how the complete JSP file can look like:

    <!DOCTYPE html>
    <html lang="en">
        <head>
            <title>Test</title>
            <style>
                #progress { 
                    display: none;
                }
            </style>
            <script>
                function showProgress() {
                    document.getElementById('progress').style.display = 'block';
                }
            </script>
        </head>
        <body>
            <form>
                <input type="submit" onclick="showProgress()">
                <img id="progress" src="progress.gif">
            </form>
        </body>
    </html>
    

    Or when CSS/JS is externalized in its own file (recommended):

    <!DOCTYPE html>
    <html lang="en">
        <head>
            <title>Test</title>
            <link rel="stylesheet" href="style.css">
            <script src="script.js"></script>
        </head>
        <body>
            <form>
                <input type="submit" onclick="showProgress()">
                <img id="progress" src="progress.gif">
            </form>
        </body>
    </html>
    

    See also:

    • HTML tutorial
    • Where to start from in web development?
    • Java Webdevelopment – What skills do I need?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have web application written in java using Eclipse. It has just one servlet
I have this servlet program and an external .jar file (written by someone else)
I have written a MapReduce program, code is below: import java.io.IOException; import java.util.Iterator; import
I have written a java servlet that uploads multiple files, I used cURL to
I have written a Java servlet and run it through local Tomcat 7, but
I have written a program which reads input from csv file and its working
I have written a standalone Java application that I've packaged into a jar file
I have written a JAVA servlet that implements the Facebook Connect feature. I have
I have written a RIA using flex for the front-end and Java servlet for
I have written a raw binary image file into a buffer which is an

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.