91-9990449935 0120-4256464 |
Example of Fetching Result for the given rollnoHere, you will learn that how to fetch result for the given rollno. I am assuming that there is a table as given below: We are assuming there are many records in this table. In this example, we are getting the data from the database in servlet and printing it. We are doing all the database logic in servlet for simplicity of the program. But it will be better to separate it from the servlet file. Example of Fetching Result for the given rollnoIn this example, we have create three files
index.html This page gets rollno from the user and forwards this data to servlet which is responsible to show the records based on the given rollno. Search.java This is the servlet file which gets the input from the user and maps this data with the database and prints the record for the matched data. In this page, we are displaying the column name of the database along with data, so we are using ResultSetMetaData interface. web.xml file This is the configuration file which provides information of the servlet to the container.
download this example (developed without IDE)
download this example (developed using Myeclipse IDE) download this example (developed using Eclipse IDE) download this example (developed using Netbeans IDE) To connect java application with the Oracle database ojdbc14.jar file is required to be loaded. Put this jar file in WEB-INF/lib folder. |