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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:37:26+00:00 2026-05-23T21:37:26+00:00

I have used the following code to create a file in a temp location

  • 0

I have used the following code to create a file in a temp location and save an image in that location, when this page is loaded i always see a red cross ” if the older image is deleted or always shows the cached image not the latest image” .

 String file_suffix=df.format(new Date());
            File file= new File("/home/martini/Apache/tomcat/apache-tomcat-5.5.27/webapps/dashboard/tmp_imgs/tmp"+file_suffix +".jpeg");
            if(!(file.exists())){
                file.createNewFile();
            }
             p_resp.setContentType("image/jpeg");
                chart = u.genarateLineChart(m_martiniInstance);
                ChartUtilities.saveChartAsJPEG(file, chart, 625, 800);

                HTMLHelper.writeHTMLHead(m_out);
                 m_out.println("<body bgcolor=\"#B4A383\"> "
                            + "  <center> "
                            + "  <img src=\"/dashboard/_imgs/sungard_martini.png\" alt=\"SunGard Martini\" border=\"0\" /> "
                            + "  <p><br><br></p>");
                    m_out.println(
                             "  <div align=center>"
                            + "  <img src=\"/dashboard/tmp_imgs/tmp" + file_suffix + ".jpeg\" border=\"0\" /> "
                            +"</div>"
                            + "  <p><br><br></p>");

I would like a new file to be created for the image every time and load the new image in a temp file irrespective of a previous image in a temp file being present.
Is there any way of achiveing this because when i see a red cross or a older file i refresh the page and then i see the new image being loaded.

Thanks,

Bhavya

  • 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-23T21:37:28+00:00Added an answer on May 23, 2026 at 9:37 pm

    Try to call response.setHeader("Cache-Control","no-cache"); in the beginning of your servlet’s doPost()/doGet() method. This should prevent caching.

    Other trick is to add some kind of dummy parameter at the end of URL. This can be implemented using javascript at client side. For example your url looks like:

    http://myserver/myapp/images/myimage.jpg

    change it to

    http://myserver/myapp/images/myimage.jpg?dummy=123456

    The value of dummy parameter may be timestamp in milliseconds or random number etc.

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

Sidebar

Related Questions

I have used following code to create a simple PDF file. It executes fine
I have used the following code in my models.py file: Create hyperlink to foreignkey
I have the following code in an Autofac Module that is used in my
I have successfully used the following command line to create a new GIF image
i have used following code to repeat a process creation/close iteratively dim vProcessInfo as
I have used the following code in a number of applications to load .DLL
i have used the following code in .htaccess Options +FollowSymlinks RewriteEngine On RewriteBase /
I have the following code - it is used to load a drop down
I have used the code supplied in the following CodeProject article in the past
i have the following function i wrote to create an XML file using Xerces

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.