its very urgent please help me

its very urgent please help me

how can i retrieve all images from ms access database and display in jsp pages

View Answers

March 2, 2011 at 10:37 AM

JSP retrieve all images from MS Access database:

1)images.jsp:

<%@ page import="java.sql.*,java.io.*,java.util.*" %> 
<HTML>
 <table >
   <%
  try{      
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:student");
    Statement stmt=con.createStatement();
    String strQuery = "select * from user";
    ResultSet rs = stmt.executeQuery(strQuery);
    while(rs.next()){
       %>
      <tr>

      <td>
      <img src="image.jsp?imgid=<%=rs.getInt(1)%>" width="100" height="100">
</a></td>
      </tr>
      <%
    }
    rs.close();
    con.close();
    stmt.close();
  }
  catch(Exception e)
  {
    e.getMessage();
  }
  %>
 </table>
</HTML>

2)image.jsp:

<%@ page import="java.sql.*,java.io.*,java.util.*" %> 
<%
  int id =  Integer.parseInt(request.getParameter("imgid"));
  try{      
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:student");
    Statement st=con.createStatement();
    String strQuery = "select image from user where id="+id;
    ResultSet rs = st.executeQuery(strQuery);

    String imgLen="";
    if(rs.next()){
      imgLen = rs.getString(1);
       }  
    rs = st.executeQuery(strQuery);
    if(rs.next()){
      int len = imgLen.length();
      byte [] rb = new byte[len];
      InputStream readImg = rs.getBinaryStream(1);
      int index=readImg.read(rb, 0, len);  
      st.close();
      response.reset();
      response.getOutputStream().write(rb,0,len); 
      response.getOutputStream().flush();        
    }
  }
  catch (Exception e){
    e.printStackTrace();
  }
%>









Related Tutorials/Questions & Answers:
its very urgent please help me
its very urgent please help me  how can i retrieve all images from ms access database and display in jsp pages
Please help me... its very urgent
Please help me... its very urgent  Please send me a java code to check whether INNODB is installed in mysql... If it is there, then we need to calculate the number of disks used by mysql
Advertisements
Ple help me its very urgent
Ple help me its very urgent  Hi.. I have one string 1)'2,3,4' i want do like this '2','3','4' ple help me very urgent
urgent...pleAse help me.....please!
urgent...pleAse help me.....please!  please help me urgent! how can i do dictionary with the use of array code in java, where i will type the word then the corresponding meaning for that word will appear...thanks
Please help me urgent...........
Please help me urgent...........  For what kind of a problem would use a Tree Set and not a Tree Map For what kind of a problem would use a Tree Map and not a Tree Set   Hello Friend,ADS_TO_REPLACE_1 If you want
pls help me sir its urgent
pls help me sir its urgent  thanks for reply, but i am getting this error pls help me its urgent type Exception report message description The server encountered an internal error () that prevented it from
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP   The Task Write a class whose objects will represent students. The class should have three fields for representing a studentâ??s
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP   Write a class whose objects will represent students.The class should have three fields for representing a studentââ?¬â?¢s name, this studentââ?¬â?¢s
very urgent : Iam unable to code this program plz help me - RMI
very urgent : Iam unable to code this program plz help me  Write a Multi-user chat server and client.  Hi friend, Chat server is a standlone application that is made up the combination of two-application, server
PLease reply its urgent
PLease reply its urgent   Write a java function that has the signature ââ?¬Å?Public static int clock Inter sections(int hours, int minutes)ââ?¬Â...:minute:second format.   How's that urgent
servlet not working properly ...pls help me out....its really urgent
servlet not working properly ...pls help me out....its really urgent  Hi, Below is the front page of my project 1)enty.jsp </form> <...;Please go through the following link: Servlet Tutorials
urgent please, help!
urgent please, help!  how to make jTable unclickable and have unmovable columns, thanks in advance   import javax.swing.*; import java.awt.*; public class SimpleJTableExample{ public static void main(String[] args
please help me.
please help me.  Please send me a code of template in opencms and its procedure.so i can implement the code. Thanks trinath
pls help me it urgent
pls help me it urgent  hey, pls help me i want to know that can we call java/.bat file from plsql/proceudre /trigger
pls help me it urgent
pls help me it urgent  hey, pls help me i want to know that can we call java/.bat file from plsql/proceudre /trigger
pls help me it urgent
pls help me it urgent  hey, pls help me i want to know that can we call java/.bat file from plsql/proceudre /trigger
Help Very Very Urgent - JSP-Servlet
requirements.. Please please Its Very very very very very urgent... Thanks...Help Very Very Urgent  Respected Sir/Madam, I am sorry..Actually the link u have sent was not my actual requirement.. So,I send my requirement
reply me its urgent - Java Beginners
reply me its urgent  Hi friends I am facing problem in my application in this type please help me i am using database mysql5.0 version...'@'localhost' (using password: YES)" please tell me what is the error....its
its urgent for me - Development process
its urgent for me  Hi All, this is kalavathi,i am new to alfresco.present i am using alfresco3.9b version.my problem is i was writing code in java... is the problem .can u tell me i will send my total code and error exception also. import
displaying List of records from database in a jsp using ajax, onclick it should display the results ?? its urgent can u help me
displaying List of records from database in a jsp using ajax, onclick it should display the results ?? its urgent can u help me   displaying List... ?? its urgent can u help me
please help me.
please help me.  How to read a properties file in java with a suitable example. Please send me. Thanks Trinath   Please visit the following link: Java read properties file
please help me.
please help me.  Please send me the validation of this below link. the link is http://www.roseindia.net/answers/viewqa/JSP-Servlet/9584-JSP-Servlet-Search-and-Edit.html Thanks Trinath
please help me.
please help me.  How to move the edits.jsp in below link? http://www.roseindia.net/answers/viewqa/JSP-Servlet/9584-JSP-Servlet-Search-and-Edit.html
please help me
please help me  how to use two browse buttons, one browse button for displaying the first image and second for the second image along with its file path and also to display text file along with its path using layouts or panels
please help me
please help me  how to use two browse buttons, one browse button for displaying the first image and second for the second image along with its file path and also to display text file along with its path using layouts or panels
please help me.
please help me.  I have a jsp page under that i add a list box under i get the countries through my database. so how can i do
help me please
help me please   Hello I want helping for this question , Please Write a program that reads some friendsââ?¬â?¢ names, stores them in an array, and then prints out on the screen all friends who start by a particular letter
please help me
before. This name list should get from the database. Please help me. By the way, I'm...please help me  Dear sir, I have a problem. How to write JSP coding, if a user select a value from drop down list for example department, the another
please help me.
please help me.  I have three table in mysql,and i hava create a excel sheet and add this sheet.but my question is in every sheet i can display one one table result.how can i do
Please help me.
Please help me.  Hi i am trinath in below there is a url.In that url there is a code of edit a jsp page.I understand that code but only one thing i not get it i.e; What is the work of "id".and what is the data type of id? http
please help me...
please help me...  write an application that print number in the following order using a FOR-Loop 1 2 3 4 5 2 4 6 8 10 3 6 9 1215 4 8 121620 5 10152025
please help me in these prog
please help me in these prog   create 2 jdbc programs including awt create 2 jdbc programs including swing create 2 jdbc programs including command line argument create 2 jdbc programs including io class 4 jdbc prog using
please help me to this problem..
please help me to this problem..  i wrote a program like keyboard... inside the JTextField) but i want to make this program to let me write where i clicked (i.e allows me to write any thing at the field where i clicked
Programming help Very Urgent - JSP-Servlet
Please please its very urgent.. Thanks/Regards, R.Ragavendran..  ...Programming help Very Urgent  Respected Sir/Madam, Actually my code shows the following output: There is a combo box which contains all the ID's
Please help me
Please help me  program for when a user enter his card number, it has to create default security pin in the database
Please help me
Please help me  Hi Sir, please send me the code for the following progrems... 1) all sets are integer type: input: set1={10,20,30,40} set2={15,25,35} output: union={10,15,20,25,30,35,40} 2) input: "Hi what
please help me
please help me  interface Test1 { String toString(); } public class Test { public static void main(String[] args) { System.out.println(new Test1() { public String toString() { return "test
please help me?
please help me?  Define a class named Circle with the following properties: List item An integer data field named radius with protected access modifier, and a String data field named colour with private access modifier. Both
Please help me??
Please help me??  Question_1: Using one-dimension array of primitive type elements. Objective: The purpose of this lab exercise is to practice how to declare, create and manipulate a one-dimension array of primitive type
Please help me out
Please help me out    Description* You are hired to develop a laptop inventory information system for Sheridan College in order to keep track of the information about the laptops lent to the students. Users can add or remove data
help me please
help me please  how can i do dictionary with the use of array code in java, where i will type the word then the corresponding meaning for that word will appear...thanks
please help me here
please help me here  please show me how can this show the right output that i need please continue doing this program using only if else and do while please please" here is the problem Automatic Teller Machine [B] Balance [D
please help me here
please help me here  please show me how can this show the right output that i need please continue doing this program using only if else and do while please please" here is the problem Automatic Teller Machine [B] Balance [D
Please help me to learn - WebSevices
Please help me to learn  Please help me to learn Java Fast
please help me to overcome this problem
please help me to overcome this problem  how to make it easy to write java code. can u please give me suggestions
HQL Statement: Please help me
= Product.productGroupVersionId and Product.lobId = ? Can you please help me equallent HQL...HQL Statement: Please help me  Select ProductFamily.* from ProductFamily, ProductGroup, Product where ProductFamily.productFamilyVersionId
Please help me understand this query
Please help me understand this query  Hi, Could someone please help me understand the following query. Im finding difficulty relating it :-( Pls Help! select * from cbpartner where CBPartner.IsSummary='N' and salesrep_id
plz help -java project very urgent
plz help -java project very urgent  ? Ford furniture is a local furniture store in acts, and they as CS graduate students to implement a software system to generate various reports for them at the end of each month. You
Help me please!!! - Java Beginners
Help me please!!!  im badly needing the complete code for this project in java!!! can you please help me???!!! it is about 1-dimensional array... the answers 8Hours from now!!! Kindly help me!! please!!please!!! NOTE
Begineer in coding please help me
address to a person object.. please help me...Begineer in coding please help me  I have Person class{ int pid; String Pname; //and have a Address filed of type Address not String!!! Address

Ads