Results 1 to 2 of 2
  1. #1
    satishgauns is offline Member
    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    0

    Default Servlet URL from JSP IMG not invoked second time

    Hi,

    I am using serlvet URL to display image using IMG tag as below

    <img src="/register/logoimages?action=displayuploaded"/>

    Where
    1. /register/logoimages is the mapped servlet URL.
    2. action=displayuploaded will display the uploaded image.

    I have a JSP page 1 which provide option to upload a image file.
    When page 1 is loaded first time, servlet /register/logoimages is invoked and executed (first call to servlet) to try to display image. As image is not yet uploaded by user image is not displayed. Fine.
    Now, When user upload image on page 1, user is directed to same page 1 and uplaoded image is to be displayed using above IMG tag which invokes servlet /register/logoimages (second call to servlet)

    This is working fine on IE 8 browser and uplaoded image is displayed.

    Problem:
    This does not work on Mozilla (16.0.2) and IE 8 browser on other machine (works only on my machine IE 8 browser)
    In Mozilla (16.0.2), the uploaded image is not displayed. When I check the logs servlet /register/logoimages is not executed during second call (after uploading image).

    When I check IE and Mozilla header content, below diffrence I found

    IE8:
    Accept=image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, */*
    Cache-Control=no-cache

    Mozilla (16.0.2):
    Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Cache-Control= THIS IS NOT IN HEADER

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,008
    Rep Power
    20

    Default Re: Servlet URL from JSP IMG not invoked second time

    I suspect it's down to cacheing.
    So you need to ensure you have all the various ways to prevent client side cacheing for that image in your response.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Get Invoked Methods BCEL
    By Astrid in forum Advanced Java
    Replies: 1
    Last Post: 05-18-2012, 05:56 PM
  2. Replies: 5
    Last Post: 02-29-2012, 10:07 AM
  3. Replies: 3
    Last Post: 08-23-2011, 12:46 PM
  4. Replies: 0
    Last Post: 12-31-2008, 02:20 PM
  5. Date/Time Servlet
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-14-2008, 09:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •