Question: Help on JSP and JDBC



Share on Google+Share on Google+

Manoj Kumar Singh
Help on JSP and JDBC
2 Answer(s)      9 years ago
Posted in : JDBC

Retrieve data from Database in JSP and JDBC connection.

View Answers

April 2, 2008 at 8:51 PM


<%@ page language="java" import="java.sql.*,java.util.*,java.text.*" %>
<title>Retrive value from database</title>
<table border="0" width="50%" cellspacing="0" cellpadding="0">
<td width="100%">
<h2><font color="#FF0033">Retrive data from database</font></h2>
<form method="POST" >
<table border="1" width="50%" cellspacing="0" cellpadding="0" bgcolor="#66FFCC">
<td width="50%" valign="right"><b>ID</b></td>
<td width="50%" valign="right"><b>Employee Name</b></td>
<td width="50%" valign="right"><b>Position</b></td>
Connection con = null;
String url = "jdbc:mysql://localhost:3306/";;
String db = "register";
String driver = "com.mysql.jdbc.Driver";
con = DriverManager.getConnection(url+db,"root","root");
Statement st = con.createStatement();
String query = "SELECT * FROM emp_details";
ResultSet rs = st.executeQuery(query);
while ( {

<td width="50%" valign="right"><%=rs.getInt("empno")%></td>
<td width="50%" valign="right"><%=rs.getString("empname")%><br/></td>
<td width="50%" valign="right"><%=rs.getString("job")%><br/></td>
catch(SQLException ex){
System.out.println("SQL statement is not executed!");
catch (Exception e){

April 8, 2008 at 4:04 PM

hi friend,
jsp only for view , we should use for presentation don t combine databse code and jsp, it is not good approach,use separate class for connection from that class get values.

jsp only for view , even html designers can do this, we are java programmers keep mind


Related Tutorials/Questions & Answers:
Help on JSP and JDBC - JDBC
Help on JSP and JDBC  Retrieve data from Database in JSP and JDBC...;% Connection con = null; String url = "jdbc:mysql://localhost:3306/"...;hi friend, jsp only for view , we should use for presentation don t
Help on JSP - JDBC
Help on JSP  Sir I am makeing a project name Online reservation and Enquiry system. I had completed the front end design with the help of html,delete and search the database from the html file with the help of JSP.  hi
Jsp,JDBC  Write a Program using Servlet,JSP, JDBC and XML to create a web application for a courier company to provide an online help in tracking the delivery status of items.  Hi friend, For solving the problem
JDBC in JSP  Sir, I got a problem in my jsp page which contains... happening for my update query. Please help me with a suitable suggeastion. Regards Sreejith  send me your jsp coding then i can understand what
JDBC with JSP  how to get a combo box value and pass it to the java method in a jsp program dynamically, without moving to servlet or next page
JSP help
JSP help  Hi i am using jsp,html and mysql. I am displaying one question & their 4 options per page. For that i have one label for question &... do this? Please Help
jsp help
jsp help  Hi i am doing my project in jsp.using netbeans 6 and mysql 5.0. and i managed to complete it. and now its submission time. but am confused... with it. so that my project can run independently in any server. plz help me. am so
jdbc,jsp - JDBC
jdbc,jsp   this is my jsp code in this code i have to give hyperlink to database(selected row must be deplay)  Hi keerthi, replace the line
Help on JDBC and my SQL 5 database - JDBC
Help on JDBC and my SQL 5 database  Dear Sir, I had create a statement for the JDBC as shown below: try... the connection c = DriverManager.getConnection ("jdbc:mysql
JDBC in JSP   Sir, This is the code showing the problem. regards sreejith
JDBC in JSP   Sir, This is the code showing the problem. regards sreejith
jsp - JDBC
jsp  My code is not working please anyone help me to store retrieved... variable. JSP Page... Login Successful <%-- <jsp:forward page="studenthome.jsp"/>
jsp-jdbc - JDBC
jsp-jdbc  Hi! html- jsp-jdbc program from the html form where... jsp frequently. I am getting error through request.getParameter(). can you please...="DriverManager.getConnection("jdbc:odbc:ashokdb","scott","tiger"); Statement st
jsp - JDBC
JSP Storing Data, Datatype vale in SQL   Storing Data, Datatype vale...;<%Connection con = null; String url = "jdbc:mysql://localhost:3306..., will help you in storing date in sql database.See how to insert data from html
jsp - JDBC
jsp  I have one jsp code.but it is included oracle databse...("oracle.jdbc.driver.OracleDriver"); Connection con = DriverManager.getConnection("jdbc:oracle... = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:oracle","scott","tiger"); I
JSP Store Results in Integer Format  JSP Example Code that stores the result in integer format in JSP  Hi! Just run the given JSP Example...;/b></td><% Connection con = null; String url = "jdbc:mysql
jsp - JDBC
jsp  -------------------------------------------------------------------------------- how to receive data into jsp from html for dropdown boxes
urgent help needed in JDBC AND JAVA GUI - JDBC
urgent help needed in JDBC AND JAVA GUI  my application allows... want any one to help me convert from scanner to java GUI for this code...(); } } // thanks for any help rendered   Hi Friend, Try the following code
jsp - JDBC
jsp  i am doing project in java using jsp as font end and microsoft access as back end my project airline ticketing reservations how can i give hyperlink to database rows in jsp code.   First
jsp help - JSP-Servlet
jsp help  hai friends i am using videos,which will play on my webpage using doubt is where will i store my videos whether in the database or in another local folder. please help me as soon as possible thanks
jsp - JDBC
jsp  how to link jsp code with next htmlcode.  Hi keerthi, Can u explain ur question clearly? What is your exact Requirement
jsp - JDBC
about update at
jsp - JDBC
: Unable to compile class for JSP An error occurred at line: 20 in the jsp file...\localhost\Airlines-Project\org\apache\jsp\ cannot find symbol symbol : variable src location: class org.apache.jsp.Flightdetails_jsp
jdbc-jsp  <html> <head> <title>your info mail</title> </head> <body bgcolor=#FAEBD7> <center><u>... = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root
JSP and JDBC - JSP-Servlet
JSP and JDBC  Respected sir/Madam, I am R.Ragavendran.. I... for JDBC codings must be present.. NOTE: When User clicks Insert,for example...; IF I GET THIS HELP IN TIME.... Thanks/Regards, R.Ragavendran.
be JSP-->Servlet-->JDBC-->Services-->JSP 3, Update - The table created... if we give the form ID in a JSP and submit delete. Please help me...JSP-Servlets-JDBC  Hi all, 1, Create - i want sample code
jsp help - JSP-Servlet
jsp help  i want to add n remove rows dynamically and also want to add data in database in jsp ....  Hi Friend, Try the following code: 1)table.jsp: Add/Remove dynamic rows in HTML table function
jsp help - JSP-Servlet
jsp help  In below code value got in text box using 'ID' Attribute ... I want to use that value in query to fetch related values in same page...:// Thanks
jsp help - JSP-Servlet
jsp help  i got below code for dynamically add n delete row... but in my table there are 17 colum in 1 row..i want to add whole row with 17 cloum.. so which changes are required??? 1)table.jsp: Add/Remove dynamic
Query regarding JSP, JDBC
Query regarding JSP, JDBC  can I get the code for the question asked by me regarding JSP,JDBC
Programming in JDBC and JSP - JSP-Servlet
Programming in JDBC and JSP  Write a program using JDBC and JSP to display the names and addresses of all those MCA students at your study centre... Semester.   Hi friend, Code to help in solving the problem
Java Spring Hibernate Struts Training how to retrieve text and images from mysql database and show on html page using jsp servlet How to install Neo4j on Ubuntu 15.10? please help me in these prog MYSQL - mysql copy table to another table example by creating new table solution for mapping hibernate and pojos from net beans through database Connect GWT application with Oracle inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store This code have created jTable that connected with a database.every cell of last column have a button.But this button doesn't work properly.Where is the error java program Java Database Program jdbc Database connection class in a live project ..?? What is JDBC architecture? Unable to Create DSN for excel to ms access importing data and edit that data Database Scrolling Buttons how to use foreign key in java How to delete content of a log file from linux terminal? JSP-Oracle connectivity Student Management System Java code for Saving Marathi (Indian local language ) in Mysql and retrieving the same crud operations with foreign key constraint. I really need help with this assignment question Please help me out Please Backup Failed Mysqldump Got Errno 28 On Write Upgrade MySQL 5.1 to 5.5 in cpanel mysqldump all databases com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'jpa.sequence' doesn't exist persistence xml class element persistence.xml for MySQL MySQL JDBC Driver pom dependency code Blob column jdk6 and oracle 8i connexion oracle 8i et jdk6 java [ cannot retrive date from sql ] why?? Order Entry System How to threow timeout exception when DB is not responding How to threow timeout exception when DB is not responding This is the employee form to add data to mysql database but I got error of NullPointerException, Is this write code please give me feedback as soon as possible make a method which takes user name & pwd as parameter & validate them against the database. If the corresponding user exist return true otherwise false. prabhakar validating credentials and displaying error message in login .jsp if not valid JDBC jdbc jdbc code register servlet vibhu connectiondetails from vibhu


Advertisement null