Results 1 to 8 of 8

Thread: Displaying an image and text in a JSP

  1. #1
    Join Date
    Nov 2009
    Posts
    678

    Displaying an image and text in a JSP

    Hello, I am working on java programming and recently started to learn the Jsp. I have quiet confused about the Displaying an image and text in a JSP page. I have tried to achieve it, but I am not able to get the solution for it. If anyone is having more knowledge about it, then please help me to achieve it.

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    Re: Displaying an image and text in a JSP

    Hey, I have created the code below for you for Displaying an image and text in a JSP.
    Code:
    ServletOutputStream sOS = response.getOutputStream();
    
            img = InputStream post.getResponseBodyAsStream();
          
            InputStream in = new BufferedInputStream(picture);
            
            String str = post.getResponseHeader("Content-Type").getValue();
            String len = post.getResponseHeader("Content-Length").getValue();
            response.setContentType(str);
           
            byte[] buf = new byte[Integer.parseInt(len)]; 
            int bytesRead; 
            while ((bytesRead = in.read(buf)) != -1) { 
              sOS.write(buf, 0, BytesRead);
            }
            sOS.flush();
            
            response.setContentType("text / html");
            sOS.System.out.println("BLalalLALAllal");
            sOS.close();

  3. #3
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Displaying an image and text in a JSP

    Hey, it is quiet simple to display an image and text in a jsp page. For that it is just needed to add the code provided below in your program, so just make use of it and solve your problem.
    Code:
    <img src="imagename=Techarena"/>  
    Now here you can specify the text which you want to display.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Displaying an image and text in a JSP

    Hello, I think if you refer the given books below then you will able to get the solution for your problem of your Displaying an image and text in a JSP:
    • Java Cookbook
    • Web Development with JavaServer Pages, Second Edition
    • Professional JSP
    • More Servlets and JavaServer Pages

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: Displaying an image and text in a JSP

    Hey, I think if you make use of the flow ServletOutStream with the code provided below you will get soluiton for your problem:
    Code:
    OStream.flush();
    res.setContentType("text / html");
    OStream.System.out.println("Started");
    OStream.close();

  6. #6
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Displaying an image and text in a JSP

    If you make use of the Javascript for Displaying an image and text in a JSP then you will simply able to get the solution for your problem:
    Code:
    <html>
    <head>
    <title></title>
    <script type="text/javascript" language="javascript"><!--
    function Testing()
    {
       var element = document.getElementById("TextBox");
       element.value = "Check it!";
       return true;
    }
    //--></script>
    </head>
    <body>
    <br><br>
    <center>
    <img src="img.gif" alt="Click here" onclick="Testing()" />
    <br><br><br>
    <input type="text" size="35" id="TextBox" value="" />
    </center>
    </body>
    </html>

  7. #7
    Join Date
    Mar 2010
    Location
    india
    Posts
    2

    Re: Displaying an image and text in a JSP

    i think you can use code like

    < %
    int count=new File(file path).testFiles().length.
    % >

    and use html

    <img src=" "+count.jpg+""

  8. #8
    Join Date
    Mar 2010
    Location
    india
    Posts
    2

    Re: Displaying an image and text in a JSP

    hi
    now i work with oracle 10g but in jdbc connection , i want to know about what are jdbc drivers availables in oracle 10g


    and give code for connection

Similar Threads

  1. problem with displaying image
    By ibiangalex in forum Software Development
    Replies: 1
    Last Post: 27-10-2010, 03:31 AM
  2. Alt Text for pictures not displaying in IE 8
    By Pomegranate in forum Technology & Internet
    Replies: 6
    Last Post: 09-08-2010, 04:07 PM
  3. Nokia 6303, problem displaying image(s)
    By Ganaka in forum Portable Devices
    Replies: 4
    Last Post: 19-04-2010, 10:28 AM
  4. Displaying an Image In a JSP With a Access database
    By Henryosa in forum Software Development
    Replies: 5
    Last Post: 12-03-2010, 03:52 PM
  5. Displaying an image with Qt
    By Zool in forum Software Development
    Replies: 3
    Last Post: 08-12-2009, 11:57 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,399,399.90260 seconds with 17 queries