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



Home Answers Viewqa JSP-Servlet JSP Retrieve value from Database
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


sivaram
JSP Retrieve value from Database
1 Answer(s)      6 years and 9 months ago
Posted in : JSP-Servlet


Please explain with the help of an example about how to Retrieve value from Database using JSP?


Advertisement
View Answers

March 4, 2008 at 8:27 PM


Retrieve value from Database
Methods and ways through which you can retrieve values on tag using JSP.

JSP Example Code

retriveValue.jsp
<%@ page language="java" import="java.sql.*,java.util.*,java.text.*" %>
<html>

<head>
<title>Retrive value from database</title>
</head>

<body>

<table border="1" width="50%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<h1><center>Retrive value from database</center></h1>
<form method="POST" >

<table border="1" width="100%" cellspacing="0" cellpadding="0">

<tr>
<td width="50%" valign="right"><b>First Name:</b></td>

<%

Connection con = null;
String url = "jdbc:mysql://localhost:3306/";;
String db = "register";
String driver = "com.mysql.jdbc.Driver";
try{
Class.forName(driver);
con = DriverManager.getConnection(url+db,"root","root");
try{
Statement st = con.createStatement();
String query = "SELECT * FROM userdata where username='amardeep'";
ResultSet rs = st.executeQuery(query);
while (rs.next()) {
%>
<td width="50%" valign="right"><%=rs.getString("username")%><br/></td>
<tr>
<td width="50%" valign="right"><b>Position:</b></td>
<td width="50%" valign="right"><%=rs.getString("position")%><br/></td>
</tr>
<%}
rs.close();
con.close();
}
catch (SQLException ex){
System.out.println("SQL statement is not executed!");
}
}
catch (Exception e){
e.printStackTrace();
}

%>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>


Related Tutorials/Questions & Answers:
Retrieve value of radio button from database to form
Retrieve value of radio button from database to form  var gn=document.getElementsByName("empg"); //empg is name of radio input type. for(var i=0;i
how to retrieve data from database using combobox value without using request.getParameter in jsp - JSP-Servlet
how to retrieve data from database using combobox value without using request.getParameter in jsp  Answer pl
Advertisements
How to retrieve data from database by using combo box value in jsp? - JSP-Servlet
How to retrieve data from database by using combo box value in jsp?  Hello friend i want use only one jsp page.. but u give 2 pages... I want...; } function showEmp(emp_value) { if(document.getElementById("emp_id").value
how to retrieve the id value itself from the access database to drop down listbox in jsp
how to retrieve the id value itself from the access database to drop down listbox in jsp  how to retrieves the id which is an int datatype, from access database to drop down list box in jsp...plz send the code for that.....plz
retrieve value from database on the basis of maximum id number
retrieve value from database on the basis of maximum id number  hi, i want to retrieve value of maximum id number from the database and show that value in jTextField.when the user clicks on the button that maximum id number
retrieve the data to text fields from database on clicking the value of combo box
retrieve the data to text fields from database on clicking the value of combo box   retrieve the data to text fields from database on clicking... getting data into textarea from database table by clicking on the button
how to retrieve images from database to jsp?
how to retrieve images from database to jsp?  Hi sir,i want to stores images along with the name and price with database and retrieve it on jsp.and...=con.createStatement(); String strQuery = "select * from data"; ResultSet rs
retrieve related data from database using jsp and mysql
retrieve related data from database using jsp and mysql  Hi sir, please give some example of jsp code for retrieving mysql database values in multiple dropdown list. if we change a value in a dropdown its related value must
code for insert the value from jsp to access database
code for insert the value from jsp to access database  code for insert the value from jsp to access database
<img src=""> using retrieve image from database using jsp
using retrieve image from database using jsp  how to <img src="" > tag using retrieve image from database and display in jsp
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
Retrieve Value from Table - Hibernate
Retrieve Value from Table   Hai friend, I need help, How can i retrieve values From database using hibernate in web Application. As I new to hibernate I couldn't find solution for this problem.. Can anyone help please.. 
how to retrieve data from database
how to retrieve data from database  unable to retrieve data from database using mySQL by using jsp sessions and beans for editing
retrieve from database........
retrieve from database........  <p>hi i am not able to retrieve string from database to a text box in web page my code is as follows:-</p>...("username"); re=stmt.executeQuery("select * from userreg where username='"+username
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
select value from autocomplete textbox using jquery in jsp from database.
select value from autocomplete textbox using jquery in jsp from database. ... but was unable to find out exact way to fullfill the solution of selecting value from autocomplete textbox using jquery in jsp from mysql database. Kindly send me
select value from autocomplete textbox using jquery in jsp from database.
select value from autocomplete textbox using jquery in jsp from database.  Hii Sir, Lots of thnx to ur reply .I went through both... of selecting value from autocomplete textbox using jquery in jsp from mysql database
How to retrieve image from database
How to retrieve image from database  hi........ How to retrieve image from database when it is stored. I have stored image in postgresql and want to retrieve in java form. Can u tel me hw to do? I am trying n able to do also
use data from database table as hyperlink value - JSP-Servlet
use data from database table as hyperlink value  I'm creating a web page that allows user to search my database. The page will display partial... as the hyperlink's value then pass to the next page and retrieve the complete details of the row
retrieve data from mysql database
selected value on combobox which is to be retrieve the relevant data from mysql database using php.... below my code is that.. <html> <head>...retrieve data from mysql database  hi am not familiar in php.....even
retrieve data from database with hyperlink
retrieve data from database with hyperlink  sir....i have one table called 'name' having two values i have to retrieve those data with a hyperlink... have values C C++ i have to retrieve and if i click C its sub categories should
Data retrieve from mysql database
Data retrieve from mysql database  Hi sir, please give some example of jsp code for retrieving mysql database values in multiple dropdown list. if we change a value in a dropdown its related value must be shown in the adjacent
Retrieve multiple data from database into Table.....
Retrieve multiple data from database into Table.....   hi........... I want to Retrieve multiple data from database into Table but i am not able to.... i am only able to retrieve one value not more than that. means in my
retrieve data from database using jsf
retrieve data from database using jsf  Hello I want an example of source code to retrieve data from database i have a database (oracle) name as db1...),, name ,and city I want after enter value in textbox according idauthor i retrieve
how to use bean to retrieve data from database
how to use bean to retrieve data from database  how to use bean to retrieve data from database   poda sendru
How to Retrieve data from database in jsp
How to Retrieve data from database in jsp In this section we will discuss... are going to discus about retrieve data from database in jsp.First of all we have... a database connection at the JSP page then write a SQL query "SELECT * from
How to retrieve data by using combo box value in jsp? - JSP-Servlet
How to retrieve data by using combo box value in jsp?  For example, In Employee.jsp form, When i click employee id value in combo box...... i already stored combo box values from database. pl
jsp code for a drop down box to retrive value from database
jsp code for a drop down box to retrive value from database  my project needs to get the value from database in to the drop down box..... pls give me code for that ..... tan q   1)login.jsp: <html> <script>
 

 

 

DMCA.com