database through jsp

database through jsp

sir actually i want to retrieve the data from database dynamically.because i dont know how many records are there in the database? thanks

View Answers

June 25, 2012 at 4:22 PM

Here is an example of jsp which retrieves data from database and display it in html table.

<%@ page import="java.sql.*" %>
<html>
<body>

<br><br>
<form method="post" name="form">
<table border="1">
<tr><th>Name</th><th>Address</th><th>Contact No</th><th>Email</th></tr>
<%
Connection con = null;
String url = "jdbc:mysql://localhost:3306/";
String db = "test";
String driver = "com.mysql.jdbc.Driver";
String userName ="root";
String password="root";

int sumcount=0;
Statement st;
try{
Class.forName(driver).newInstance();
con = DriverManager.getConnection(url+db,userName,password);
String query = "select * from employee";
st = con.createStatement();
ResultSet rs = st.executeQuery(query);
%>
<%
while(rs.next()){
%>
<tr><td><%=rs.getString(2)%></td>
<td><%=rs.getString(3)%></td>
<td><%=rs.getString(4)%></td>
<td><%=rs.getString(5)%></td>
</tr>
<%
}
%>
<%
}
catch(Exception e){
e.printStackTrace();
}
%>
</table>
</form>
</body>
</html>









Related Tutorials/Questions & Answers:
database through jsp
database through jsp  sir actually i want to retrieve the data from database dynamically.because i dont know how many records are there in the database? thanks   Here is an example of jsp which retrieves data from
how to connect the database using hibernet through servlet/jsp through form
how to connect the database using hibernet through servlet/jsp through form  plz give me the reply   Hi Friend, Please visit the following link:ADS_TO_REPLACE_1 http://www.roseindia.net/jsf/myfacesspring
Advertisements
design chart takes data from database and through jsp page
design chart takes data from database and through jsp page  how can I design chart takes data from database and through in jsp page
jQuery auto complete through database using JSP shows error
jQuery auto complete through database using JSP shows error  The tutorial on jQuery titled "jQuery auto complete through database using JSP" shows error on browser when I try to select the one in the dropdown. Please help
Upload Image to Database through Servlet - JSP-Servlet
Upload Image to Database through Servlet  Hello, I make a application from where I upload the Image from local disk then store in DB.Before storing the Image in DB I want to check this program. I include the commons
jQuery auto complete through database using JSP
jQuery auto complete through database using JSP In this tutorial, we will implement auto complete through database using JSP. In this example a text box... it , by completing text using JSP. JSP page take the uncompleted text  form text
what is proper way to save pictures in SQl database and call it through JSP ?
what is proper way to save pictures in SQl database and call it through JSP ?  Hi guys, I usually store picture path in DB and call them through 'getContextPath()' mehtod using this method I can call pictures and Text on same
Retrieve image from mysql database through jsp
Retrieve image from mysql database through jsp... to retrieve image from mysql database through jsp code. First create a database... Note : In the jsp code given below, image will be retrieved from database
downloading file through a file's path stored in database in jsp
downloading file through a file's path stored in database in jsp  hi... in a database,i have done the coding for retrieving the path from database to a html... in database.here is my code for retrieving the path from database. <%@ page import
Navigation in a database table through jsp
Navigation in a database table through jsp  .... Create a database:  Before run this jsp code first create a database named... a table named 'stu_info' in the same database through following sql query
How can I access databse through JSP. I am using postgresql-8.4.4-1-windows as database and jboss-4.0.5.GA as server.
How can I access databse through JSP. I am using postgresql-8.4.4-1-windows as database and jboss-4.0.5.GA as server.  I am using postgresql-8.4.4-1-windows as database, jboss-4.0.5.GA as server and jdk-6-windows-i586 with IDE
Adding image to database through jsp or HTML page ,while adding only image should show.
Adding image to database through jsp or HTML page ,while adding only image should show.   Adding image to database through jsp or HTML page... different jsp or HTML page. please help me. Thanks in Advance
Connecting to a database through the Proxy.
Connecting to a database through the Proxy.  Connecting to a database through the Proxy I want to connect to remote database using a program that is running in the local network behind the proxy. Is that possible
how to read data from excel file through browse and insert into oracle database using jsp or oracle???
how to read data from excel file through browse and insert into oracle database using jsp or oracle???  sir.. i have number of excel sheets which... be inserted into oracle database.. please help me sir...   hi friend
Insert data in mysql database through jsp using Prepared Statement ---- Please Resolve it
Insert data in mysql database through jsp using Prepared Statement ---- Please Resolve it   I have tried the following code Database creation: create database studentdb; create table stu_info ( ID int not null auto
Insert data in mysql database through jsp using Prepared Statement ---- Please Resolve it
Insert data in mysql database through jsp using Prepared Statement ---- Please Resolve it   I have tried the following code Database creation: create database studentdb; create table stu_info ( ID int not null auto
jsp database
jsp database   I want to retrive value in my jsp page but i dont want show my database query in my jsp page. is there any other method to show value in my jsp page using java class
Login through database with the help of jQuery 'ajax' & JSP
Login through database with the help of jQuery 'ajax' & JSP... a login page , which has a JSP page to perform database connection. In this example , login page contain jQuery ajax to make connection with JSP ,which
jdbc connectivity through jsp
jdbc connectivity through jsp  my code: <%@ page language="java... org.apache.jasper.JasperException: An exception occurred processing JSP page /mypage.jsp...) org.apache.jsp.mypage_jsp._jspService(mypage_jsp.java:105
Create a Table in Mysql database through SQL Query in JSP
Create a Table in Mysql database through SQL Query in JSP...; This is detailed java code to connect a jsp page to mysql database and create a table of given...;/html> Save this code as a .jsp file named "welcome_to_database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
How to sent mails through jsp application
How to sent mails through jsp application  when i fill the form, and submit it, then a mail should be sent to persons mentioned in the form and i want to conect the jsp page to database
Migrating sql database to Access through coding
Migrating sql database to Access through coding  How can i migrate SQL database(table) to My access through coding
Insert data in mysql database through jsp using prepared statement
Insert data in mysql database through jsp using prepared statement...; This is detailed jsp code that how to insert data into database by using prepared statement instead of statement.  Create a database: First create a database named

Ads