MCQs Test!! VB Basic Test !! Essentials of VB !! Creating User Services !! function !! Anatomy !! GK March-2019 !! DATA TYPES IN JAVA !! Classes ,Constructor ,Methods,Inheritance !! Ecology-I !! Biology 2019 !! Gk april 2019 !! Biology (living world) !! Plant anatomy !! CELL STRUCTURES AND FUNCTION !! General biology !! Human physiology !! Data structure !! Ecology-II !! GK TEST !! Reproduction in plants !! Human reproduction !! The ABC of C !! Operating system set1 !! Operating system set2 !! Gk and current affairs !! Animal kingdom !! Number system !! Animal kingdom-II !! Gk TEST-III !! Number series !! Microorganisms !! Interview question in c !! Time and Work !! Percentage !! General history !! Average !! Cells !! Locomotion and Movement !! paging !! Bacteriology !! Page replacement policy !! Secondary memory and Disk scheduling !! Introduction of Nervous System and neurons !! Plant harmones !! Transport and Mineral Nutrition in Plants !! Neurotransmitters !! Modern Indian History !! Photosynthesis in Plants !! Modern Indian History-II !! Plant respiration !! Environment & Biodiversity !! Environment & Biodiversity - II !! Algae, Bryophytes, Pteridophytes !! Area !! Cricket !! Days of the Year (India and the World) !! Plant Pathology - I !! Indian Transport System !! Plant Pathology - II !! Aptitude !! Biology !! Botany !! C language !! Computer Science !! Core Java !! Gate !! GK !! Mysql !! Operating system !! Physics !! VB-Visual Basic !! Zoology


Fetching the table data from the database on the jsp page using servlet in Hibernate
Previous Home Next

For making these application we are using the NetBeans and appache tomcat server and mysql server. As we discussed in last application There we have discussed how to send data into the database using hibernate with the action of servlet. Now we will work how can we show the data on the jsp page in a table formate for showing the report chart. For this time of Application we need to Follow some basic step which we have given here:

Step 1. We will work on the same application(HibernateApplicationUsingServlet) name as we given in the insert operation example and here database will be same and table name also will be same.

In the above image we can see the what we need to do in this session. By which action and where we need to peroform the action.

Step 2. Now we need to create a jsp page(FetchDataList) for making the action to show the database table on the jsp page in a table formate. For this we need to go in the File menu wizared as we given in the last example for taking the jsp file. Than we need to go in the New file option of File Menu Wizard then search to web and click on jsp page which is shown in the next tab of the web and after the clicking on the next a window will be open put name of that file and click finish.



<%@page import="org.hibernate.criterion.Restrictions" %>
<%@page import="org.hibernate.*" %>
<body bgcolor="lightyellow">
    <table width="500" border="1"><tr><th>Sr. No</th><th>First Name</th><th>Last Name</th><th>Age</th>
	<th>When Inserted</th></tr>
            SessionFactory sf = r4r.HibernateUtil.getSessionFactory();
            Session s = sf.openSession();
            Transaction tr = s.beginTransaction();
            Criteria cr = s.createCriteria(r4r.InsertData.class);
            java.util.List<r4r.InsertData> us = cr.list();
            for(r4r.InsertData dr : us)
            out.println("<h2>We have found these some data which is given in the table from the database");

Step 4. Now build the project and run the project.

Here the above example we can show the database data into the jsp page as a table formate. If any where we required any kind of report.

Previous Home Next