how to make employee i card

how to make employee i card

hello friends

can anyone help me..

I have to make a project to make Identity card for employees...but i am facing problems with database and jsp connection ...

also tell me how to retrive data such as name and image at a paticular place on the I-card...plz reply as soon as possible....

Thank you in advance

Rohan

View Answers

September 17, 2012 at 11:42 AM

Here is a jsp code that retrieves the name and image from the database and display it in the html table.

1)data.jsp:

<%@ page import="java.sql.*,java.io.*,java.util.*" %> 
<HTML>
 <table border="1">
 <tr><th>Name</th><th>Address</th><th>Image</th></tr>
   <%
  try{      
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");
    Statement stmt=con.createStatement();
    String strQuery = "select * from data";
    ResultSet rs = stmt.executeQuery(strQuery);
    while(rs.next()){
       %>
      <tr>
      <td><%=rs.getString("name")%></td><td><%=rs.getString("address")%></td>
      <td align="center">

<img src="image.jsp?imgid=<%=rs.getInt(1)%>" width="50" height="50">
</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("com.mysql.jdbc.Driver").newInstance();
    Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");      
    Statement st=con.createStatement();
    String strQuery = "select image from data 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:
how to make employee i card
how to make employee i card  hello friends can anyone help me.. I have to make a project to make Identity card for employees...but i am facing... such as name and image at a paticular place on the I-card...plz reply as soon
How to make a valentine card
How to make a valentine card Learn a easy technique to make a valentine card. It is very interesting design, I hope you will like it. Follow now step by step instruction to make it. New File: Take a new file
Advertisements
how can i make monthly register ?
how can i make monthly register ?  how can i make monthly register ? iam using jdeveloper
how I make the numbers in descending order ?
how I make the numbers in descending order ?   public class Quiz1...]+" "); } } thanks how I make the numbers in descending order ?   ...(System.in); int number [] = new int [20]; int num =2; for(int i =0; i<
How do I write a program to manage an employee's business and personal contacts?
How do I write a program to manage an employee's business and personal contacts?  A. Input Requirements 1. Include a prompt that allows the user to enter a command from the following four options, repeating the process
how can i make a session invalidate in java when browser is closed
how can i make a session invalidate in java when browser is closed   how can i make a session invalidate in java when browser is closed   ...). So I wanted to make the session invalid when browser/tab is closed like gmail
How do I make an n list size in Python
How do I make an n list size in Python  Hi, I am working on a project where I have to make array of pre-defined size and fill it with zero. How do I make an n list size in Python? Thanks   Hi, I Python you can do
how do i make a phone call from my app without quitting my application
how do i make a phone call from my app without quitting my application  hi, I am working on creating a call application, i am making a call from my... quits , i want my application to go to background and resume on call end ...please
how to make multiple rectangles
how to make multiple rectangles  I,m a beginner , m sorry if the question is really simple i have an array list.I want to print the contents..."); classlist.add("card"); classlist.add("yes"); for(int i=0;i<=classlist.size();i
How to send request to the visa/master card to get verifed the credit card - Security
How to send request to the visa/master card to get verifed the credit card  Sending request to verify the card number
How to make a sharpen image
How to make a sharpen image I am going to make a sharp picture effect, I have here a dog picture to modify. Open Picture: Capture a picture to make sharp effect. ADS_TO_REPLACE_1 Effects: Go
How to make selectOneMenu scrollable
How to make selectOneMenu scrollable  how to make the selectOneMenu scrollable? I have around 20 values in drop down and i want the scrollable functionality after 5 values. Kindly reply as soon as possible. Thanks Shikha
How to send request to the visa/master card to get verifed the credit card - Security
How to send request to the visa/master card to get verifed the credit card  we are accepting the credit card number, So how to forward request get verified the card number. Thanks You
How to make first JSP page?
How to make first JSP page?  Hello, How I can make first JSP page? Thanks
how to calculate the employee tax - JSP-Servlet
how to calculate the employee tax  How to calculate the employee tax.Can u please send to me calculation tables
how make ID - Ajax
how make ID  how make a ID in eyeball chat
How to make elements invisible ?
How to make elements invisible ?   How to make elements invisible
how to make this pattern???
how to make this pattern???  how to make following pattern in javascript
how to make exampage in jsp ?
how to make exampage in jsp ?  how to make a online exam page in jsp and servelet
How to send request to the visa/master card to get verifed the credit card - Security
How to verifed the credit card  Can anyone please explain me ...how to verify the card number while accepting payment online
How to make a text effect.
How to make a text effect.       This is a text effect tutorial, you can make your text into a deferent condition by my this example.  There is so many type to make
how to make a program on array
how to make a program on array  When you make a program on array that the element will move downward and upward and when you input twice 0 then thats the time that it will not move. pls. give me a formula...tnx
how to make multiple choice questions
how to make multiple choice questions  I have to make a multiple choice choice using JSP/Servlets. I created a a session bean for the questions and answers. how to associate group of questions to a user? so each user will have
How to make a transparent text
How to make a transparent text Learn how to make a transparent... mask tool (T key) and make formatting as looking here. Write Text: Now write your text as you like. I have written here "Text". After writing
How to make query and abstraction in Java
How to make query and abstraction in Java  Hi, I read the lessons you have in the sites. They are really useful. However, I could not write codes... PostgreSQL database, and I want to make a query and abstraction for a table. Could
How to make bubbles, make bubbles, bubbles
How to make bubbles      ... + T  to decrease the size. Use same steps make another bubbles as I have... to make it easily to draw. New File: First take colored background file.ADS
i want make a simple tools like turnitin using java
i want make a simple tools like turnitin using java  it just simple tools can select the file like .doc,.pdf,.txt..the tools can read inside the file and make a searching at internet and give the source the source come from where
Ask make graph from i report and view to java Language Programming
Ask make graph from i report and view to java Language Programming  Dear sir, Please help me, i want to make a graph from mysql to i report and view to java. Please help me, give me example source code please. thank you
How to make a new List in Java
How to make a new List in Java  Hi, I have to create list object in Java. How to make a new List in Java? Thanks (adsbygoogle = window.adsbygoogle || []).push({});   Hi, The easiest way is to use
Bootstrap 4 card danger example
Bootstrap 4 card danger example - How to make card danger in Bootstrap 4... will teach you to make Bootstrap 4 danger card with simple example code... with various customization  options. The card in Bootstrap 4 is one
How to Make iPhone Window Application
How to Make iPhone Window Application  Hi, For Making iphone window application, what parameters i have to follow or provide example related to iphone window application. Thanks
How to make first JSP page?
How to make first JSP page?  Hello, How I can make first JSP page? Thanks   HI, Beginner can learn JSP from writing the first Program... tutorial: How to make my first JSP page? Thanks
how make excel
how make excel  how make excel spreadsheet IN JAVA. please send this code argently   Hello Friend, Try the following code: import java.io.*; import org.apache.poi.hssf.usermodel.HSSFSheet; import
How to make a chain, make a chain, chain
How to make a chain       To learn how to design a chain in the photoshop has become so easy by this example, it has some important instruction to make it so follow
how to make paging with function ?
how to make paging with function ?  how to make paging with function ?   //this page is display.php <?php</p> $con=mysql_connect("localhost","root",""); if(!$con) { die("you can connect please check". mysql
how to make a field left justification
how to make a field left justification  how to make a field left justification.need code.thanks in advance
how to make a label left alignment?
how to make a label left alignment?  how to make a label left alignment
HOW TO STORE MULTIPLE EMPLOYEE DETAILS TO XML FILE USING JSP?
HOW TO STORE MULTIPLE EMPLOYEE DETAILS TO XML FILE USING JSP?  HELLO SIR, CAN ANYONE HELP ME OUT HOW TO STORE MULTIPLE EMPLOYEE DETAILS TO XML FILES,IF I ENTER 4 EMPLOYEE DETAILS(NAME,ID,SALARY,EMAIL) ALL THE DETAILS OF 4
hi , i cant make this programmer , can any one help me to make it pls - Java Beginners
hi , i cant make this programmer , can any one help me to make it pls  ...://www.roseindia.net/java/example/java/io/ Thanks  i want to make the whole... ? -Update record(s)? -Delete record(s)? -Make one copy of a specific text file
I am good in programming. Can I make career in Big Data and Hadoop?
I am good in programming. Can I make career in Big Data and Hadoop?  Hi, I am a Java programmer with experience in Java, Advanced Java, JSP, Servlet... of enterprise applications. Can I make career in Big Data and Hadoop? Thanks   
How to make a button of different behaviour?
How to make a button of different behaviour?  Suppose In a jsp page I...").value,......); Now I want the SAVE button to be changed to UPDATE button id... ajaxInsertUpdateData(document.getElementByID("btnSave1").value,......); How to do
how to make paging with class and ajax
how to make paging with class and ajax  paging with class and ajax
How to make directory in java
Description: This example demonstrate how to create a directory at specified path. Code: import java.io.File; public ... is that it will make a dir at root directory of C drive
How To Make This Program - Java Beginners
How To Make This Program  How To Make Java Calculation program I... number, prints it, then calculates the sum... output: 59 14 5 please help to make...{public static void main(String args[])throws IOException{int i,a=0,b,n=0,count=0
display the employee name
display the employee name  when i will select one employee designation based on that employee designation display the particular designation employee name display in another select box how it possible using servlet and mysql
How to make a bone, make a bone, a bone
How to make a bone       This example bone design example, It is very easy. If you are looking for, please follow now. New File: Create a new file.ADS_TO_REPLACE_1
how i want to create a coding by this question?
how i want to create a coding by this question?  Design and write a class named Person and its two subclasses named Student and Employee. Make Lecturer and Admin subclasses of Employee. A person has a name, address, phone number
How can I do it? .click();
want that it make mouseup in this element. How can I do it, because if I write...How can I do it? .click();  I have a very unusual problem. I want to make a script like this: <script> x = document.getElementById
How to make halo effect
How to make halo effect       Now get ready to learn a simple way to make a halo effect on the picture, follow to make it. Take a picture: Capture any picture to give
How to make a cross eye, make a cross eye, cross eye
How to make a cross eye       You can make a cross eye effect with any type of eye picture by using... any eye picture as I have here.ADS_TO_REPLACE_1 Selection: Make selection

Ads