How to use bytes

How to use bytes

I have saved my project and uploaded the picture. But when i want to view the picture, there was no picture. I used the method listEmployeeByID and the bean is

if (rs.next()) { bean.setEmployeephoto(rs.getBytes("employeephoto"));

How to get the correct answer to view the picture by using bytes?

View Answers

July 25, 2011 at 10:43 AM

InputStream sImage;
if(rs.next()){
      byte[] bytearray = new byte[1048576];
      int size=0;
      sImage = rs.getBinaryStream(1);
      response.reset();
      response.setContentType("image/jpeg");
      while((size=sImage.read(bytearray))!= -1 ){
      response.getOutputStream().write(bytearray,0,size);
   }
}

July 25, 2011 at 7:18 PM

ok i'll try that. thanks anyway.









Related Tutorials/Questions & Answers:
How to use bytes
How to use bytes  I have saved my project and uploaded the picture...(rs.getBytes("employeephoto")); How to get the correct answer to view the picture by using bytes?   InputStream sImage; if(rs.next()){ byte[] bytearray
how to convert image into bytes and also retrive the image from that bytes - Java Beginners
how to convert image into bytes and also retrive the image from that bytes  how to convert image into bytes and also retrive the image from that bytes?  Hi friend, Code to help in solving the problem : import
Advertisements
How to get bytes from ByteBuffer in java.
How to get bytes from ByteBuffer in java.       ...;  In this tutorial, we will discuss how to get bytes from buffer...() method of ByteBuffer class  reads bytes of from  buffer's
How to read bytes from a Linked list - Java Beginners
How to read bytes from a Linked list  i have stored byte array into a linked list. How to read the bytearray dta byte after byte from a linked list.Thanking u in advance Sameer
ModuleNotFoundError: No module named 'bytes'
ModuleNotFoundError: No module named 'bytes'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'bytes' How to remove the ModuleNotFoundError: No module named 'bytes'
Java file bytes
Java file bytes In this section, you will learn how to read bytes from a file... of all classes that represents an input stream of bytes. FileInputStream: This class obtains input bytes from a file in a file system. read()-  
Place array of bytes in buffer
Place array of bytes in buffer In this tutorial you will see how to place array of bytes in buffer. The put method of CharBuffer class transfers the entire content of the given source character array into a buffer. Code
1024 bytes equals to
1024 bytes equals to  1024 bytes equals to   1024 bytes equals to 1 KB
ModuleNotFoundError: No module named 'protobuf-bytes'
named 'protobuf-bytes' How to remove the ModuleNotFoundError: No module named 'protobuf-bytes' error? Thanks   Hi, In your python...ModuleNotFoundError: No module named 'protobuf-bytes'  Hi, My
ModuleNotFoundError: No module named 'yelp_bytes'
'yelp_bytes' How to remove the ModuleNotFoundError: No module named 'yelp_bytes' error? Thanks   Hi, In your python environment you...ModuleNotFoundError: No module named 'yelp_bytes'  Hi, My Python
ModuleNotFoundError: No module named 'bytes-warning'
'bytes-warning' How to remove the ModuleNotFoundError: No module named 'bytes-warning' error? Thanks   Hi, In your python...ModuleNotFoundError: No module named 'bytes-warning'  Hi, My
ModuleNotFoundError: No module named 'bytes-string'
'bytes-string' How to remove the ModuleNotFoundError: No module named 'bytes-string' error? Thanks   Hi, In your python...ModuleNotFoundError: No module named 'bytes-string'  Hi, My Python
concatenation of Two bytes in C
concatenation of Two bytes in C  Hi, I need to concatenate two bytes array in C.How to do that. bytes[0] = (n >> 24) & 0xFF; bytes[1] = (n >> 16) & 0xFF; bytes[2] = (n >> 8) & 0xFF; bytes[3] = n &
displaying output on web page immediately whent the jsp buffer size is full. And how to set jsp buffer size in bytes
displaying output on web page immediately whent the jsp buffer size is full. And how to set jsp buffer size in bytes  Here is my requirement, I have to display output on the browser after jsp buffer is full. And I have to set
Order bytes from most significant to least significant.
Order bytes from most significant to least significant. In this tutorial we will discuss on how to use the ByteOrder class for ordering bytes from most significant to a least significant. Code: import 
Order bytes from least significant to most significant.
Order bytes from least significant to most significant. In this tutorial we will discuss on how to use the ByteOrder class for ordering bytes from least significant to a most significant. Code: import 
Version of com.tmiyapub>bytes-regex dependency
List of Version of com.tmiyapub>bytes-regex dependency
Maven Repository/Dependency: com.tmiyapub | bytes-regex
Maven Repository/Dependency of Group ID com.tmiyapub and Artifact ID bytes-regex. Latest version of com.tmiyapub:bytes-regex dependencies... at: Maven Tutorials What is Apache Maven? How to create Maven
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for bytes-regex version 0.0.1
be able to use the dependency given here for the  bytes-regex version 0.0.1... tool which you use to manage your project and easily use bytes-regex version...Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for bytes-regex
Maven Dependency bytes-regex >> 0.0.1
You should include the dependency code given in this page to add Maven Dependency of com.tmiyapub >> bytes-regex version0.0.1 in your project
Java Write To InputStream
Java Write To InputStream In this tutorial you will learn how to write to InputStream in java. Write to file from InputStream in java you may use the InputStream class of java.io package. This class reads the streams of bytes
how to write file from FileInputStream
how to write file from FileInputStream  Hi, How to Write a file.... Thanks,   Hi, For Write to file from FileInputStream in java you may use... bytes from a file or can say it reads the streams of bytes. For Reference visit
How a split a file into many based on size?
How a split a file into many based on size?  Consider a text file which has a size of 400 bytes, i need to split up the contents in that 400 bytes file into 100 bytes of separate files.So there should be totally 4 files should
How to use update and reset method of CRC32
How to use update and reset method of CRC32.In this tutorial, we will discuss... in  java.util.zip package .  In this example, you will see how... stream for reading bytes from file.  The read() method  of 
How to write to file using FileOutputStream
How to write to file using FileOutputStream  Hi friends, Please help me in java program. How to write to file using FileOutputStream? thanks,   Hi, To write a file using FileOutputStream, we have to use
How to use Servlet and Ajax?
How to use Servlet and Ajax?  How to use Servlet and Ajax
How to use random access file
How to use random access file In this section, you will learn the use of RandomAccessFile class. RandomAccessFile allows read and write operations to any... with a large array of bytes and uses the file pointer  to deal with the index
how to use calender in php
how to use calender in php  how to put calender in php
How to use AT Commands with J2ME?
How to use AT Commands with J2ME?  How to use AT Commands with J2ME? Thank you for your answer
how to use mouse pressed
how to use mouse pressed   to action mouse clicked
how to use button in array
how to use button in array  plz tell me how to code for button in array
How to Use Collections
How to Use Collections  how to use ArrayList and HashMaps in case of user defined class  Hi Friend, Please visit the following links: http://www.roseindia.net/java/jdk6/ http://www.roseindia.net/javacodeexamples
how to use setAttribute
how to use setAttribute  how to get following codes using setAttributes in java??? Employee xlink:type="extended" xlink:show="new" xlink:actuate="onRequest
How to use dojoscript with jsf?
How to use dojoscript with jsf?  Hi all , am new to jsf. can anyone help me out in using dojo script frame work with jsf. how to integrate dojo into jsf. Thanks in advance
how to use JOptionPane.YES_NO_OPTION
how to use JOptionPane.YES_NO_OPTION  As i said earliar i am making... logging out finally.. i also thinking how to use the input (yes or no ) given... dialog should appear which ask for yes or no . PROBLEM is i dont know how
how to use an editable combobox
how to use an editable combobox   Hello Everyone!!!!!!!! I have a jcombo box with certain values and i want to use it as an editable that means when user will type something in combobox, according to that text only matching item
How to use ajax in jsp?
How to use ajax in jsp?  Hi, How i can access the server-side data in JSP using the Ajax? Thanks   Hi, You can use the Ajax code to access the server side data from JSP page. Check the tutorial Combo Box Using Ajax
how to use jstl tags?
how to use jstl tags?  I installed jstl jar in my libraries. I got the following error in console screen. I need the solution to resolve this uri in web.xml. please help me.......... "The absolute cannot be resolved
How to use Apache POI?
How to use Apache POI?  Can anyone tell me how to use Apache POI??I went through http://poi.apache.org/ but cannot understand anything.I don't know how to implement.Please help me out.   Download zip file from
How to use between in mysql.
How to use between in mysql.  I want to display records inbetween two dates and also want to use where condition( like and deptname='Pediatry Department').      Syntax: SELECT column_name(s) FROM table_name
How To Read File In Java
How To Read File In Java In this section we will discuss about about how data of a file can be read in Java. A file can contain data as bytes, characters, binary data etc. To read a file in Java we can use following of the classes
how to use dirivers - JDBC
how to use dirivers  i try connecting to a database with this code but i get this ClassNotFoundException, already i have added the path to the connector to my classpath variable. here is the code; import java.sql.Connection
how to use - EJB
how to use  I am buiding a Shopping cart and i want to fetch image and its product id from the database(MySql) and fetching of image should be done by JPA
How to use this keyword in java
How to use "this" keyword in java   ... use this keyword. Here, this section provides you an example with the complete code of the program for the illustration of how to what is this keyword and how
How to use Map in velocity
How to use Map in velocity       This Example shows you how to use map in velocity. The method used in this example are described below:-   1:- Initialize
How to use List in velocity
How to use List in velocity       This Example shows you how to use List in velocity. The method used in this example are described below:-  1:- Initialize
How to retrive an inmage from database and displaying it in imgae box - Swing AWT
How to retrive an inmage from database and displaying it in imgae box ... or pane in a JFrame.. is this possible? can you plz help tell me how we can do..._id='1'"); byte[] bytes=null; if(rs.next()) { bytes=rs.getBytes(1
How to use for loop in jsp
How to use 'for' loop in jsp page ? This is detailed java code that shows how to use 'for' loop in jsp page. 'if' statement is used to test conditions while... for the loop. In this example, we have developed use_for_loop.jsp page which shows
how to use image tag in jsp
how to use image tag in jsp  How to use image tag in JSP
How to use Hibernate get sessionfactory?
How to use Hibernate get sessionfactory?  Hi, How to use hibernate get sessionfactory? Thanks

Ads