Home Answers Viewqa HTML how to fill up a form automaically from database and print it

 
 


bhargavi
how to fill up a form automaically from database and print it
1 Answer(s)      10 months ago
Posted in : HTML

sir,i am designing a medical license website.i need to fillup a license form atuomatically from details stored in database.ex:if there are details of a person like name age etc..,on clicking the name the whole details of that name(like age)should automatically fill up in the form and on cliking print button it shoulg give a print out. i need code for this in jsp .plsss help me sir

View Answers

July 23, 2012 at 1:33 PM


Here is a jsp code where user is allowed to enter any id and display the corresponding data into another textboxes. We jave used Ajax here to display the context on the same page.

1)ajax.jsp:

<%@page import="java.sql.*"%>
<html>
<head>
<script type="text/javascript">
function showData(){ 
xmlHttp=GetXmlHttpObject()
    var id=document.getElementById("id").value;
var url="getdata.jsp";
url=url+"?id="+id;
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged(){ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 

  var showdata = xmlHttp.responseText; 
    var strar = showdata.split(":");
      if(strar.length>1)
         {
        var strname = strar[1];
        document.getElementById("name").value= strar[1];
        document.getElementById("address").value= strar[2];
         }

 } 
}
function GetXmlHttpObject(){
var xmlHttp=null;
try{
  xmlHttp=new XMLHttpRequest();
 }
catch(e){
 try{
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch(e){
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
</script>
</head>
<body>
<br><br>
<table >
<tr><td>Client ID:</td><td><input type="text" id="id" name="id" onkeyup="showData();"></td></tr>
<tr><td>Name:</td><td><input type="text" id="name" name="name"></td></tr>
<tr><td>Address:</td><td><input type="text" id="address" name="address"></td></tr>
</table>
</body>

2)getdata.jsp:

    <%@ page import="java.sql.*" %> 
    <%
    int id = Integer.parseInt(request.getParameter("id"));

     String data=" ";  
     try{
      Class.forName("com.mysql.jdbc.Driver");
               Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
     Statement stmt = con.createStatement();  
     ResultSet rs = stmt.executeQuery("Select * from addclients where clientid  ="+id+"");  
       while(rs.next())
                    {
                        data = ":" + rs.getString("name") + ": " + rs.getString("address");
                    }
                    out.println(data);
      }
     catch(Exception e){
    System.out.println(e);
     }

 %>
</html>









Related Pages:
how to fill up a form automaically from database and print it
how to fill up a form automaically from database and print it  sir,i am designing a medical license website.i need to fillup a license form...)should automatically fill up in the form and on cliking print button it shoulg give
how to fill up a form automaically from database and print it
how to fill up a form automaically from database and print it  sir,i am designing a medical license website.i need to fillup a license form...)should automatically fill up in the form and on cliking print button it shoulg give
how to fill up a form automaically from database and print it
how to fill up a form automaically from database and print it  sir,i am designing a medical license website.i need to fillup a license form...)should automatically fill up in the form and on cliking print button it shoulg give
how to fill up a form automaically from database and print it
how to fill up a form automaically from database and print it  sir,i am designing a medical license website.i need to fillup a license form...)should automatically fill up in the form and on cliking print button it shoulg give
how to fill up a form automaically from database and print it
how to fill up a form automaically from database and print it  sir,i am designing a medical license website.i need to fillup a license form...)should automatically fill up in the form and on cliking print button it shoulg give
how to fill up a form automaically from database and print it
how to fill up a form automaically from database and print it  sir,i am designing a medical license website.i need to fillup a license form...)should automatically fill up in the form and on cliking print button it shoulg give
Print Form - Java Beginners
Print Form  Hello Sir I have Created Admission Form when user fills data and submit that data to access database,then when i Click on PRINT Button I want to get Print of that forms Contents,How I can Do it with JAVA SWING,plz
how to check the radio button automatically depending up on the value of database when editing the form...
how to check the radio button automatically depending up on the value of database when editing the form...  hi...in my application i am editing the form and in that form the data in the database should come but icant be able
Displaying Database information on the browser.
of PHPMyAdmin) Up to now, we learned how to create database and insert information in the database. In this tutorial, I will show you how to insert the information...;); ?> In the above code, I connect the form with the database and also
Setting up the database in PHP
PHP DATABASE Setup Part-5(a) : Setting up the database In this chapter, we will tell you how to create a database and tables in MySQL and also how... a database to insert the information into and read it from. I think your mind raises
fill out forms on web pages - JDBC
www.blauh...com , in which there wil be a form , what i hav to do is to fill that form....   Hi Friend, We have used database to get the form details according...fill out forms on web pages    I want to fill out forms on web
How to connect to database to my application if the database is made up in oracle
How to connect to database to my application if the database is made up in oracle  How to connect to database to my application if the database is made up in oracle   Hi Friend, Follow these steps: 1) Import
fill combobox at runtime jsp
fill combobox at runtime jsp  i have 1 combobox in jsp which is filled with value from sql db on load of form <% Class.forName...(); ResultSet re = s.executeQuery("select distinct From1 from station"); %>
how to print pdf format
how to print pdf format  Hi every body iam doing school project iam using backend as oracle front end java .how to print student marks list... is a code that will store the database data into pdf table. We have used itext api
Navigate database values using up and down key of keyboard
Navigate database values using up and down key of keyboard In this section, you will learn how to navigate database values using up and down keys... the database values. On pressing the up key, the following code will fetch one by one
Setting up Database with the help of PHP Scripts.
PHP Database Set Up Script Part-5(c) : Setting up the database 2. Database... in the last tutorial that MySQL has its own standard set up to create database which..., tables and contact form with the help PHP scripts. A. Database Creation Firstly
how to print JInternal frame component ?
how to print JInternal frame component ?  hello sir, i devalop a swing application .but problem is that how display report & print it. some data prefech from database & keep to jtable but how it is print with table
How to check for Empty textboxed and fill it with a value on a button click
How to check for Empty textboxed and fill it with a value on a button... of from the first text box and should be added to the target text box and sit...;body> <form name="myform"> <input type="text" name="Allocation" size
Accessing database from JSP
Accessing database from JSP   ... going to discuss the connectivity from MYSQL database with JSP.we take a example.... First we learn how to create tables in MySQl database after that we write
how to print headings horizontally in jsp
how to print headings horizontally in jsp  In one of my jsp i have used for loop. in every iteration it will fetch value from db and print it on heading section, it prints vertically but my requirement is to print it horizontally
print a form of *
print a form of *   * *** ***** ******* ********* ******* ***** *** *   Post the format properly
How to connect to the database to my application if my database is made up in oracle
How to connect to the database to my application if my database is made up in oracle   How to connect to the database to my application if my database is made up in oracle
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
how to genrate login id and password after submitting the sign up form?
how to genrate login id and password after submitting the sign up form?  i m working on a online voting project in that i have a user sign up form so i want 2 knw that after user submit all the details i that sign up form than
how to include Timestamp into my enquiry form? - Java Beginners
how to include Timestamp into my enquiry form?  Dear expert, I'd like to include a timestamp function into my enquiry form. However, I am stuck... = con.prepareStatement(strCreateRecordSQL); //Fill up the blanks
how to print the server time
how to print the server time  i want to print database time in clintside and update time in every secound without creating connection to database for each time. how can i do
how to print from right to left in java????
how to print from right to left in java????   can anyone pls tell how to print from right to left in java
how can i print the selected content of a frame
how can i print the selected content of a frame  hello sir, I am designing a bill calculate program. I want to print the bill in crystal form. I want to skip all the text fields shapes and all the button from the frame.. but all
How to print this in java?
How to print pattern in Java?  How to print a particular pattern... and click the button that consists of binary number 0 and 1 from the text editor.    How to print this in java
Multipage form
Multipage form  I have a multipage form in php with 2 pages wnhen i submit the form data from both the pages should go in database how should i pass teh data from 1st page to 2nd page and then put the entire form data in mysql
print
print  How to print JFrame All Componant?   Please visit the following link: http://www.roseindia.net/java/example/java/swing/Print.shtml
JSP Ajax Form
Ajax Form Example This example explains you how to develop a form that populates dynamically from the database though Ajax call. When user selects employee id from the combo box then the corresponding employee details are populated
Invoice Form
Invoice Form  How can I create an Invoice web application (preferable PHP) with customer look-up (with option to add new customer) and a grid to add... on quantity and unit price. Print functionality would also be a great addition
PHP Form Part-5
how the form information is going to display in the browser. In the previous... will be used in the Php Script. Let's see the syntax how to return information from..., we used the inbuilt function called $_POST[] to get POST data from a form. We
How to fill double array in java
How to fill double array in java  how to fill double array in java
How to delete the row from the Database by using while loop in servlet
How to delete the row from the Database by using while loop in servlet .... It is Urgent...  When you retrieve the data from the Database by using... server database by using Servlet program (Tomcat server). In Database table
PHP Form, PHP guest form
by string, by the means of a loop from 0 up to the array size (count($n...PHP email form HTML form It's not a good idea to leave your private e.... But nevertheless you need some way to get feedback from your visitors. In the three parts
Backing Up and Restoring A MySQL Database
; This tutorial explains the how to backup and restore the MySQL Database. Databases...; backup data can be used to restore the Database. Backing Up MySQL Database MySQL... of backing up MySQL Database named "accounts" into text file
How to send from netbeans gui registration form to MySQL query browser database?
How to send from netbeans gui registration form to MySQL query browser database?  Well i have a Registration form GUI in my netbeans. in my GUI... Browser database. what code will i do? this is my existing code from my
How to send from netbeans gui registration form to MySQL query browser database?
How to send from netbeans gui registration form to MySQL query browser database?  Well i have a Registration form GUI in my netbeans. in my GUI... Browser database. what code will i do? this is my existing code from my
how to print data(From databse Oracle10g) in preformatted A4 and A3 paper using jsp
how to print data(From databse Oracle10g) in preformatted A4 and A3 paper using jsp  how to print data(From databse Oracle10g) in preformatted A4 and A3 paper using jsp. I am inserting analysis report into a database using
Registration Form
username,password,date of birth,Mobile number number into database. How to insert Date of birth from Drop down to database and how to validate user entered String
print the multiplication table up to one
print the multiplication table up to one  My problem is that I have to change the code so that the user can tell the program which factor that should...; System.out.println("Enter an integer to print it's multiplication table
Backing Up and Restoring A MySQL Database
; This tutorial explains the how to backup and restore the MySQL Database...; backup data can be used to restore the Database. Backing Up MySQL Database... the example of backing up MySQL Database named "accounts" into text file
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
print only Form Fillup Contents through Text File - Java Beginners
print only Form Fillup Contents through Text File   Hello Sir ,I have Designed Employee Details Form using java swing components Now i want to print contents which is filled by employee,How i can Print it,and also i want print
how to send and retrieve image along with text to and from database
how to send and retrieve image along with text to and from database  im using app engine and i have two logics from different sources and i want to combine them. ive used the greeting example from app engine and i have a random
How to delete the row from the Database by using servlet
How to delete the row from the Database by using servlet  Dear Sir... then the user data to be delete from the database table. Assume in Database table have...: Delete row from database using servlet   In that link solution
JSP to add details to a database from a HTML form.
JSP to add details to a database from a HTML form.  Hi I'm a second year CS student who has to use JSP to validate a HTML form and add the details... from form and stores it in User--%> String Pword = request.getParameter
swings:how to link from one form to another form
swings:how to link from one form to another form  how to link from one form to another form

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.