Downloading a jpeg image in new window


General J2EE: Downloading a jpeg image in new window

  1. Downloading a jpeg image in new window (5 messages)


    I'm trying to open different types of Attachments. All The attachments are opening with their respective applications In new window.

    E.g .doc in MSWord.

    Whereas coming to JPEG, gif files. These are opening in the same window . I need to open them in new window.
    I'm writing this code for opening an attachment :


    BufferedInputStream bis = new BufferedInputStream(blobStream);
    int aByte = 0;
    while ((aByte = != -1) {

    I want to do this at Client Side.
    Please help me.

    Threaded Messages (5)

  2. Open new window whenever user clicks on URL of JPG file using javascript.
  3. Use the JavaScript method.

    Basically, something like this:

    function openImage(image)
    {, "imageWindow", "width=400,height=400");

    and in your JSP page, you could do:

    <a href="#" onclick="openImage(<%= destFileName %>)">View File</a>
  4. Downloading a jpeg image in new window[ Go to top ]

    Oops! I forgot the quotes. The link should look like:

    <a href="#" onclick="openImage('<%= destFileName %>')">View File</a>
  5. Javascript?[ Go to top ]

    one should avoid using javascript where it is not nessecary.

    <a href=&quot;image.jpg&quot; target=&quot;_blank&quot;>View JPG</a>
  6. stupid[ Go to top ]

    this forum has a strange behaviour - replacing &quot; with " :

    <a href="image.jpg"> View JPG </a>

    allows you to show the image in a new window even when the client's javascript is disabled.