Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JDBC database through jsp
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


pravat kumar dash
database through jsp
1 Answer(s)      2 years and 5 months ago
Posted in : JDBC


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


Advertisement
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: http://www.roseindia.net/jsf/myfacesspring/loginRegistration.shtml Hope
Advertisements
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
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
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
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.... mysql> create database mahendra; Note : In the jsp code given below, image
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
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..._info' in the same database through following sql query :- create
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 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
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
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
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
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... as a .jsp file named "welcome_to_database_query.jsp"
update data to mysql database through JTextField
update data to mysql database through JTextField  I am getting an error, when i am updating a data to mysql database through JTextField. Send me...(); JOptionPane.showMessageDialog(null,"Data successfully Updated to the 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
 

 

 

DMCA.com