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



Home Answers Viewqa JSP-Servlet fetch values from database into text field

Have Programming Question? Ask it here!
 
 
 


megha singhal
fetch values from database into text field
1 Answer(s)      2 years and 4 months ago
Posted in : JSP-Servlet


please provide the example for fetching values from database into text field of table wth edit and delete option on each row as if i am trying following

String query = "select * from LTCINFO.PERSONS";
st1 = con.createStatement();
 rs = st1.executeQuery(query);


while(rs.next())
{
out.println("<tr>");
out.println("<td><input type=\"hidden\" name=\"P_ID\" value=\"rs.getString(1)\"></td>");
out.println("<td><input type=\"text\" name=\"LASTNAME\" value=\"rs.getString(2)"></td>");
out.println("<td><input type=\"text\" name=\"FIRSTNAME\"value=\"rs.getString(3)\"></td>");
out.println("<td><input type=\"text\" name=\"ADDRESS\" value=\"rs.getString(4)\"></td>");

the i am getting "rs.getString" in the text field also..


Advertisement
View Answers

March 23, 2012 at 5:08 PM


import java.awt.*;
import java.sql.*;
import javax.swing.*;
import java.awt.event.*;

class FormDemo{
    public static void main(String[]args){
    JFrame f=new JFrame();
JPanel panel;
JLabel label1,label2;
final JTextField text1,text2;
label1 = new JLabel();
label1.setText("Name:");
text1 = new JTextField(20);

label2 = new JLabel();
label2.setText("Address:");
text2 = new JTextField(20);


panel=new JPanel(new GridLayout(2,2));
panel.add(label1);
panel.add(text1);
panel.add(label2);
panel.add(text2);
f.add(panel);
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
        Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root", "root");
        Statement st=conn.createStatement();
        ResultSet rs=st.executeQuery("select * from data where id=1");
        while(rs.next()){
        text1.setText(rs.getString("name"));
        text2.setText(rs.getString("address"));
        }
  }
catch(Exception e){}
f.pack();
f.setVisible(true);
}
}


Related Tutorials/Questions & Answers:
fetch values from database into text field
fetch values from database into text field  please provide the example for fetching values from database into text field of table as if i am... "rs.getString" in the text field also..   import java.awt.*; import
fetch values from database into text field
fetch values from database into text field  please provide the example for fetching values from database into text field of table wth edit...;/td>"); the i am getting "rs.getString" in the text field also..  
Advertisements
retrive record from the text field and insert into to database
retrive record from the text field and insert into to database  the following code is inserting values in the my sql database but i want to insert the data into oracle database , i want what changes i have to make
How to fetch entries/values from database to a jsp page one by one?
How to fetch entries/values from database to a jsp page one by one?  I have a table in Microsoft SQL server Management Studio with two columns title... to display different database entries of the each column in different blocks. Now
Fetched Record from database show into text field of html page
Fetched Record from database show into text field of html page  hi, i have a database with field merchant_code, merchant_name, city, region, and also have html page with all above mentioned field i have submit 20 record from
fetch data from database in javascript
fetch data from database in javascript   How to fetch data from database in JavaScript when it is a leap year
how to fetch values from .properties to a html file
how to fetch values from .properties to a html file  I have a .properties file with some key value pairs in it. I need to fetch the values from this .properties file into a html file.Please let me know how to do
MySql Databse query to fetch results from database
MySql Databse query to fetch results from database  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values... the field table. Actually they are separated by comma. I want to take the values
Fetch user records from a table in database
Fetch user records from a table in database  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai... the field table. Actually they are separated by comma. I want to take the values
automatically move next page when data fetched from database is stored in text field
automatically move next page when data fetched from database is stored in text... are stored in database wherein when the in the first text field the data is already... from database and entered the next page should load without the user clicking
to fetch data from ms word and storing into database
to fetch data from ms word and storing into database  i want to know how to fetch datafields from ms word and storing into database??? please answer soon .its urgent
MySql Databse query to fetch results from database and display it in HTML File
MySql Databse query to fetch results from database and display it in HTML File  Hi. I have a field in database named stages. its datatype is varchar... to retrieve these data from the field table. Actually they are separated by comma
Select tag to fetch data from oracle database
Select tag to fetch data from oracle database  I created a select box... of a student and when regnno is selected from the drop down list by a user... oracle database.Similarly when address will be selected by the user from
fetch values in dropdown
fetch values in dropdown  in my application i want fetch dropdown values in jsp page through servlet. means i have to fetch the database fields values in array variable of servlet and then i have to print those values in dropdown
get values from Excel to database
get values from Excel to database   hi i want to insert values from Excel file into database.Whatever field and contents are there in excel file that should go to database which exists. am using SQL Server management studio
fetch record from oracle database using jsp-servlet?
fetch record from oracle database using jsp-servlet?  how can i fetch data from oracle database by using jsp-servlet. i'm using eclipse, tomcat server and oracle database and creating jsp pages and also using servlet
Fetch Records from SQL database and convert into XML file
Fetch Records from SQL database and convert into XML file  Hi Experts... provide me the code to FULFIL my requirement.... 1) Fetch all the records from... selected rows those only needs to be update the Signature field SIGN from 'AAA
Fetching database field from servlet to jsp page ?
Fetching database field from servlet to jsp page ?  Hello Java... field. I wanted to pass some of the database field from servlet to jsp... (i am opening my database in servlet init() method ) how to pass rs.getString(8
problem in setting the values from database
the values from database. here is the code: private JTextField getJTextField1() { if(text == null) { text = new JTextField...problem in setting the values from database  hello friends, can
text field
text field  How to retrieve data from text field   Hi Friend, Try the following code: import java.awt.*; import javax.swing.*; import java.awt.event.*; class RetrieveDataFromTextFields{ public static void main
Retrive data from databse to a text field - Java Server Faces Questions
Retrive data from databse to a text field  Hi, Can you give me a source code to rertrve data from Mysql databse to a text field using JSF.....by selecting option from a dropdown option
insert values from excel file into database
insert values from excel file into database   hi i want to insert values from Excel file into database.Whatever field and contents are there in excel... the following link: Insert values from excel file to database
how can retrieve more than one values in text field using ajax?
how can retrieve more than one values in text field using ajax?  im... first then in mysql db retrieve seat numbers 1,2,3,4 in text boxes problem in while loop why if write this so it is unsuccessful while($row=mysql_fetch_array
how can i store text box values as it is in database table
how can i store text box values as it is in database table  CUSTOMER DESCRIPTION
how to make drop down list in JSF & fetch data Item from database
how to make drop down list in JSF & fetch data Item from database  how to make drop down list in JSF & fetch data Item from database
fetch database value to text box based on selected value my code given below pls correct my code
fetch database value to text box based on selected value my code given below... code for me jsp file... <%@page contentType="text/html" pageEncoding...;<input type="text" value =" " property= "amount" id='pricecheck'/>
fetch database value to text box based on selected value my code given below pls correct my code
fetch database value to text box based on selected value my code given below... code for me jsp file... <%@page contentType="text/html" pageEncoding...;<input type="text" value =" " property= "amount" id='pricecheck'/> <
Getting text values from a NodeList
Getting text values from a NodeList       This Example shows you how to Get Text values from... are:- File f = new File("Document3.xml"):-Creates a File From which Text
getting values from database - JSP-Servlet
getting values from database  I tried the following code abc.html aaa.jsp I am not getting exceptions now... JSP code separately.If it will not display database values then try your code
converting field to text sql
the field to TEXT works SELECT CONVERT(TEXT,fld_name) FROM TABLE_NAME...converting field to text sql  I wanted to convert the field to TEXT in SQL.. is it possible?   SQL - Converting the field to TEXT works
Retrieve values from database using views
Retrieve values from database using views  hi......... I have a huge database so i have created views in database where i am selecting only... from that created views and display on form . I am trying to do so but its
How to update,Delete database values from jtable cells ..
How to update,Delete database values from jtable cells ..  Hello Sir, I am working on a project in which i have to fetch the values from database... records from the table cells by entering new values there only ... Sir,plz send me
How to update,Delete database values from jtable cells ..
How to update,Delete database values from jtable cells ..  Hello Sir, I am working on a project in which i have to fetch the values... the database records from the table cells by entering new values there only
fetch record from MYsql table query
fetch record from MYsql table query  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from the field table
PHP WHERE clause example to fetch records from Database Table
Server and will fetch the results from the database table employee date is equal... the data within the MYSQL database table. You can also fetch the results using...You can query a MYSQL database based on multiple conditions. PHP & MYSQL
Want solution to get values for xml namespace tags from database in java
Want solution to get values for xml namespace tags from database in java ...:loc=" "/> now i need to get values from sql database for values in the blank field(" "). how do i get these values.. already connected database and created
How to solve concurrency issue when an application is running on two machine to fetch record from one database
How to solve concurrency issue when an application is running on two machine to fetch record from one database  I have developed an application in java to run on two machines. Program will fetch a record from database and process
How to update,Delete database values from jtable cells ..
How to update,Delete database values from jtable cells ..  hello Sir... from database into jtable of a jpanel.. Now Sir, According to my need i have to update the cell values from there only means that whatever values i ma entering
Displaying the values in text fields of a form from a javascript function in jsp
Displaying the values in text fields of a form from a javascript function... to call a javascript function by passing 3 values from applet. And i have to display these values in 3 text fields of a form in the current web page. Here form
jsf text field not blank
jsf text field not blank  text field not clear in jsf onclick of reset button in my application initial value not deleted   Hello Friend, Post your code. Thanks
how to display data from database according to entered value in search field
how to display data from database according to entered value in search...(); System.out.println("Disconnected from database"); } catch (Exception e... contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C
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 get the values to dropdownlist from oracle database
how to get the values to dropdownlist from oracle database   </script> </head> <body> <select name... * from countryname"); while(rs.next()){ %> <option value="<
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file  Hi am new to java. i need to create... Solution field from database and display in the textbox of the jsp.   1
validate text field iPhone
validate text field iPhone  i got two different UITextfield in my iPhone application for user login. Just wondering how to validate
swing text field problem
swing text field problem  I want to navigate the content of text field from one class to another and viceversa through button but when I am getting the text from first class I am getting null value.please help me..here
swing text field problem
swing text field problem  I want to navigate the content of text field from one class to another and viceversa through button but when I am getting the text from first class I am getting null value.please help me..here
CALULATION IN TEXT FIELD
CALULATION IN TEXT FIELD  Suppose 3 text Field first amount ,second amount and third sum of these amount,this amount will appear when tab in next filed(i don't want use any type button) in java swing HOW? PLEASE HELP
how to move curosr from one text field to another automatically when the first textfield reaches its maximum length
how to move curosr from one text field to another automatically when the first textfield reaches its maximum length  how to move curosr from one text field to another automatically when the first textfield reaches its maximum
how to fetch data from servlet ????
how to fetch data from servlet ????  how to fetch data from servlet
Advertisements
 

 

 

DMCA.com