Results 1 to 6 of 6
  1. #1
    rameshiit19 is offline Member
    Join Date
    Sep 2010
    Posts
    12
    Rep Power
    0

    Question Unable to display gif image

    I want to display an animated gif image in my JSP page .


    I wrote the code like ,
    <div id="loginright"><img src="../image/loading.gif" /></div>

    When I open the JSP page in browser , only a " x mark " gets displayed .

    When I use,
    <div id="loginright"><img src="../image/loading.jpg" /></div>

    it works fine .

    Please help me to add gif image in jsp page ...

    Browser Used: ie 8

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default

    Nothing to do with JSPs.
    That gif image is not where you think it is.
    Do a simple HTML page which just shows those two images (gif and png), since HTML is all the browser is going to see.

  3. #3
    rameshiit19 is offline Member
    Join Date
    Sep 2010
    Posts
    12
    Rep Power
    0

    Default

    Thanks ! Both the images (gif & jpg) are getting displayed in the sample HTML page but when I use the same in jsp , only the " X Mark " gets displayed . I can able to get the path of the image by right clicking the "X Mark" .

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default

    And you've checked that the resultant HTML from the JSP is the same as the plain HTML you are checking against?
    Post them both here.

  5. #5
    rameshiit19 is offline Member
    Join Date
    Sep 2010
    Posts
    12
    Rep Power
    0

    Question

    I have just right clicked my jsp diplayed & viewed HTML source in browser as follows,

    (Gif image is not displayed)

    Java Code:
    <div id="page">
    <div id="logo"><img src="../image/logo.gif" alt="Welcome" /></div>
    <div style="margin-left: 430px; margin-top: 120px;width=300" ><font color="red"><b></b> </font></div>
    (JPG gets displayed)

    Java Code:
    <div id="page">
    <div id="logo"><img src="../image/logo.jpg" alt="Welcome" /></div>
    <div style="margin-left: 430px; margin-top: 120px;width=300" ><font color="red"><b></b> </font></div>
    Sample HTML Page (gif works fine with it) :

    Java Code:
    <div id="page">
    <div id="logo"><img src="C:\image\logo.gif" alt="Welcome" /></div>
    <div style="margin-left: 430px; margin-top: 120px;width=300" >
    </div>
    </div>

    The jsp page contains more lines of code , so I'm unable to post the complete code !

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default

    That HTML is not the same as that of the JSP.
    So it's not actually a test.

    Write an html page, deployed on the same site as your JSP page, with the same HTML code in it. I'll guarantee it doesn't work either. Your browser has no idea that that HTML has come from a JSP.

    In other words, there is no logo.gif file located in the same place as the logo.jpg file that is being displayed.

Similar Threads

  1. image display
    By asmitarnd in forum AWT / Swing
    Replies: 3
    Last Post: 04-07-2011, 11:17 AM
  2. Unable to set image as background
    By MrPremium in forum New To Java
    Replies: 1
    Last Post: 04-01-2011, 01:00 AM
  3. Unable to load an image on JPanel
    By shanthi in forum Java Applets
    Replies: 1
    Last Post: 02-28-2011, 04:55 PM
  4. Unable to display JDialog from JFrame
    By jv5 in forum NetBeans
    Replies: 2
    Last Post: 02-04-2009, 04:33 AM
  5. Unable to draw buffered image
    By pedjasmek in forum Java 2D
    Replies: 7
    Last Post: 08-08-2008, 03:49 PM

Posting Permissions

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