Home Answers Viewqa JSP-Servlet jsp programe for displaying data from database

 
 


sonika saha
jsp programe for displaying data from database
1 Answer(s)      a year and 2 months ago
Posted in : JSP-Servlet

i am using JSP.i want to insert data into database and also want to display the things i have entered in the same page inside the corresponding fields in which i have entered these data.plz some one help me..i m going to submit my project next week..

View Answers

April 4, 2012 at 4:15 PM


1)employee.jsp:

<html>
<head>
<script>
var xmlHttp;
function showState(){
    var str1=document.getElemenetByID("txt1").value;
    var str2=document.getElemenetByID("txt2").value;
    var str3=document.getElemenetByID("txt3").value;

if(typeof XMLHttpRequest != "undefined"){
xmlHttp= new XMLHttpRequest();
}
else if (window.ActiveXObject){
xmlHttp= new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlHttp==null){
alert ("Browser does not support XMLHTTP Request")
return
}
var url= "emp.jsp";
url += "?val1=" +str1+"&&val2="+str2+"&&val3="+str3;
xmlHttp.onreadystatechange = stateChange;
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
}
function stateChange(){
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
var v=xmlHttp.responseText;
var strar = v.split(":");

        document.getElementById("txt1").value= strar[1];
        document.getElementById("txt2").value= strar[2];
        document.getElementById("txt3").value= strar[3];
}
}
</script>
</head>
<body>

<table>
<tr><td>Enter Name:</td><td><input type="text" id="txt1"></td></tr>
<tr><td>Enter Address:</td><td><input type="text" id="txt2"></td></tr>
<tr><td>Enter Email:</td><td><input type="text" id="txt3"> </td></tr>

<tr><td><input type="button" value="Submit" onclick="showState();"></td><td>
</table>
</body>
</html>

2)emp.jsp:

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

String val1 = request.getParameter("val1").toString();
String val2 = request.getParameter("val2").toString();
String val3 = request.getParameter("val3").toString();

String data="";
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root";);
Statement stmt = con.createStatement();
stmt.executeUpdate("insert into data(name,address,email) values('"+val1+"','"+val2+"','"+val3"')");
ResultSet rs = stmt.executeQuery( "SELECT * FROM data");
String id="";
               while(rs.next())
                {
                    data = ":" + rs.getString("name") + ":" + rs.getString("address") +":"+ rs.getString("email");
                }
                out.println(data);




%>

For more information, visit the folowing links:

http://www.roseindia.net/answers/viewqa/WebSevices/19592-retriving-data-from-sql-server-using-jsp-code-and-placing-them-in-text-fields-of-html-code.html

http://www.roseindia.net/answers/viewqa/JSP-Servlet/9584-JSP-Servlet-Search-and-Edit.html

http://www.roseindia.net/jsp/comboSelect.shtml









Related Pages:
jsp programe for displaying data from database
jsp programe for displaying data from database  i am using JSP.i want to insert data into database and also want to display the things i have entered.../WebSevices/19592-retriving-data-from-sql-server-using-jsp-code-and-placing-them
jsp programe for displaying data from database
jsp programe for displaying data from database  i am using JSP.i want to insert data into database and also want to display the things i have entered.../WebSevices/19592-retriving-data-from-sql-server-using-jsp-code-and-placing-them
jsp programe for displaying data from database
jsp programe for displaying data from database  i am using JSP.i want to insert data into database and also want to display the things i have entered.../WebSevices/19592-retriving-data-from-sql-server-using-jsp-code-and-placing-them
displaying data
displaying data   how to display data from database on jsp using struts2
displaying data retrieved from a database in a jsp page
displaying data retrieved from a database in a jsp page  the page should display username, emailid, telephone in addition to tthe tagline however... sql = "select billid, customerid, billdate, status from customerbills where
Data displaying with limited records in jsp
Data displaying with limited records in jsp  How to display table with limited 10 records , after clicking next button another 10 records from database upto last record please help me
Displaying file from database
Displaying file from database  I have list of files in my database. I... that corresponding file from database. I have list of file id related to search. I want... strQuery = "select file_data from file where id="+id; ResultSet rs
Connecting to MySQL database and retrieving and displaying data in JSP page
Connecting to MySQL database and retrieving and displaying data in JSP page...; This tutorial shows you how to connect to MySQL database and retrieve the data from the database. In this example we will use tomcat version 4.0.3 to run our
Displaying Rows - JSP-Servlet
Displaying Rows  Hi, I need your support on how to display data from..."); out.println("Display Data from Database"); out.println(""); out.println...("Successfully insert data in database"); } catch (SQLException ex
displaying List of records from database in a jsp using ajax
displaying List of records from database in a jsp using ajax  Sir, I need to retrieve the records from the database for every 7 seconds and display... data from the database. After getting the response from the servlet am unable
image displaying from database with some other information
image displaying from database with some other information  hi, in the following section of code when i am not displaying the image it is working... only a cross mark is shows. same code runs if i am not retriveing any data from
jfreechart displaying chart from access database
jfreechart displaying chart from access database  I have these 2 codes. array.java----in which i retrieve the values from the database . import... javax.servlet.http.HttpServletResponse; /** * * @author AARUSHI */ class database { int roll; String
Displaying Date in jsp - JDBC
Displaying Date in jsp  I want to insert Date of birth of a person in a database.i am getting input value from HTML and i use jsp application to interact with database.My JSP code for inserting Date is below: String dateStr
displaying data based on criteria from 2 tables having same type of data - Java Beginners
displaying data based on criteria from 2 tables having same type of data ... thanks.   Hi Friend, You can use jsp or servlet or both. We have used jsp. Try the following code: 1)enter.jsp: function info(sub
selecting data from database
selecting data from database  how to select data from database using Dao in struts   Hi, You have to load the data from database using hibernate and send the data in a Java file object to jsp page. Please read at http
how to display data from database in jsp
how to display data from database in jsp  how to display data from database in jsp
Displaying images - JDBC
Displaying images  How to display multiple images on a single jsp from MySql database
Displaying images - JDBC
Displaying images  How to display multiple images on a single jsp from MySql database
Search data from database - Java Beginners
Search data from database  Hi Deepak, This is not correct code... searching)in name text box than all data should be displayed in another page related to user name. (means search all field from database and display using
data are not display in JSP from database - JSP-Servlet
data are not display in JSP from database   i want to finding some data through a SQL query from SQL server database to a JSP page based on some... of this jsp page. like.. School Result and three request parameters 'class', 'from
displaying data for a single column from Mysql database in the list box in php form
displaying data for a single column from Mysql database in the list box in php form  I have a form in php.want to display data from a single column...; $data = @mysql_query("select * from names"); echo "Select a Name: n"; echo "<
Problem displaying resultset in jsp(no frameworks used) - JSP-Servlet
Problem displaying resultset in jsp(no frameworks used)  Problem... area: a) How to display the records within JSP from request>arraylist>...://www.roseindia.net/jsp/servlet-jsp-data-list.shtml Thanks
xml displaying a drives data.....
xml displaying a drives data.....  Hi all, I need a solution for displaying content of a drive(Ex: c , d , e ) in the browser using the XML... data from browser. But you can create some program to display the content
To retrive data from database - Struts
To retrive data from database  How to get values ,when i select a select box in jsp and has to get values in textbox automatically from database? eg... come to jsp page automatically from database
delete data from database - SQL
delete data from database  HOw to delete specific data from table> I want to delete one record from database. Thnx  Hi friend.... http://www.roseindia.net/jsp/user-search.shtml Thanks
Display Data from Database in JSP
, to show data from the database click on the link that calls another .jsp file named...;body> <h2>Data from the table 'stu_info' of database 'student'</h2... this jsp page and show all data from the table. Click on the <--back
how to get data from database into dropdownlist in jsp
tutorial go through the link JSP Get Data Into Dropdown list From Database   ...how to get data from database into dropdownlist in jsp  Can anybody tell me what is the problem in this code as i am not able to fetch the data from
Problem in accessing data from Database
Problem in accessing data from Database  hi..... i'm making a project on servlet and jsp with ms access 2007 at the backend. One field in my database is text and all others are of currency data type. If i enter 0 or null value
how to get data from database into dropdownlist in jsp
how to get data from database into dropdownlist in jsp  //Customer Name: <select name="name"> <% try{ Class.forName...="select * from staff"; ResultSet rs=st.executeQuery(sql); while(rs.next
How to show data from database in textbox in jsp
How to show data from database in textbox in jsp   How to show data from database in textbox in jsp   Here is an example that retrieve the particular record from the database and display it in textbox using JSP. <
data retrival from database throw simple jsp..
data retrival from database throw simple jsp..  We can retrieve the the data from data base simple jsp page: Jsp Page:retrive.jsp <...; Statement stmt = null; String Query="SELECT * FROM STUD"; try
how to get data from database into dropdownlist in jsp
how to get data from database into dropdownlist in jsp  Customer Name:<select name="name"> <% try{ Class.forName...=con.createStatement(); String sql="select * from staff"; ResultSet rs
how to display data from jsp file into database
how to display data from jsp file into database  this is a jsp file...+",'"+email+"')"); out.println("Data is successfully inserted into database...(); in the below example. the error is "cannot convert from java.sql.Statement
retrive data from database using jsp in struts?
retrive data from database using jsp in struts?   *search.jsp* <%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> <... searchProduct(SearchDTO sdto) { String query="select * from product
displaying List of records from database in a jsp using ajax, onclick it should display the results ?? its urgent can u help me
displaying List of records from database in a jsp using ajax, onclick it should display the results ?? its urgent can u help me   displaying List of records from database in a jsp using ajax, onclick it should display the results
GWT -- retrive the data from Database
GWT -- retrive the data from Database  the user can create an event... button, you have to create a dynamic jsp which should read the contents from the db based on the event id. But this jsp url should be a public url. Means anyone
displaying data from ms excel in form.
displaying data from ms excel in form.  Hi all, I have a requirement as mentioned below: Requirement: I have stored some data in the ms excel... (for example). I need to display these data in a form. along with the actual picture
Getting Textbox data from database
data from database and display it on the textboxes. <%@page language="java...Getting Textbox data from database  When i m trying to get data in textbox as readonly from database i m getting following error.and my code is shown
Displaying files on selection of date.
Displaying files on selection of date.  Hi, I am developing a GUI, where i select from and to date. On selection of from and to date the GUI should... in the database for files. import java.awt.*; import java.sql.*; import java.util.
Getting Textbox data from database
;Here is a jsp code that retrieves data from database and display...Getting Textbox data from database  When i m trying to get data in textbox as readonly from database i m getting following error.and my code is shown
Retrieving newly inserted records and displaying in jsp forever
Retrieving newly inserted records and displaying in jsp forever  Sir... of every record which is displayed on the jsp (not in database) and immediately i have... record which is displayed in the jsp. I have to delete that record from the jsp
JSP Get Data From Database
JSP Get Data From Database In this section we will discuss about how to get data from database using JSP. To get data from database to a JSP page we... example which lets you understand to fetch data from database in JSP
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... from the dropdown, related data will get displayed on the textboxes. Here we have
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
Retrieval data from database against timer
Retrieval data from database against timer  Please send me a sample timer code which retrieve data from the database against timer in JSP
Read data from excel file and update database using jsp
Read data from excel file and update database using jsp  read data from excel file and update database using jsp Hi, I am using a MySQL database... upload excel file and update database using JSP ? Thanks in Advance
How we delete a data of database from front end jsp page
How we delete a data of database from front end jsp page   I make a website and featch a data from data base and now i want that a delete button put... deleted from jsp page as well as from database.I used mysql and jsp. Please help me
Display Data from Database in JSP
Display Data from Database in JSP   .... This is first jsp page that has a link 'show data from table', user can show... and run. This page has a link, to show data from the database click
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