Difference between revisions of "Java-Business-Application/C2/Creating-and-viewing-inventories/English-timed"
From Script | Spoken-Tutorial
PoojaMoolya (Talk | contribs) |
PoojaMoolya (Talk | contribs) |
||
(15 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{| border = 1 | {| border = 1 | ||
− | | | + | | '''Time''' |
− | | | + | | '''Narration''' |
|- | |- | ||
− | | 00 | + | | 00:01 |
| Welcome to the spoken-tutorial on''' Creating and viewing inventories.''' | | Welcome to the spoken-tutorial on''' Creating and viewing inventories.''' | ||
|- | |- | ||
− | | 00 | + | | 00:07 |
− | | In this tutorial we will learn | + | | In this tutorial, we will learn: |
|- | |- | ||
− | | 00 | + | | 00:09 |
− | | | + | |To modify the '''login''' page to redirect to '''admin page''' |
|- | |- | ||
− | | 00 | + | | 00:14 |
− | |To fetch all the book details | + | | To fetch all the book details |
|- | |- | ||
− | | 00 | + | | 00:17 |
| To fetch borrowed book details | | To fetch borrowed book details | ||
|- | |- | ||
− | | 00 | + | | 00:20 |
− | | To display the books borrowed by logged in user | + | |To display the books borrowed by a logged in user. |
|- | |- | ||
− | | 00 | + | | 00:25 |
− | | Here we are using | + | | Here we are using: |
|- | |- | ||
− | | 00 | + | | 00:27 |
− | | Ubuntu Version 12.04 | + | | '''Ubuntu''' Version '''12.04''' |
|- | |- | ||
− | | 00 | + | | 00:29 |
− | | Netbeans IDE 7.3 | + | | '''Netbeans IDE 7.3''' |
|- | |- | ||
− | | 00 | + | | 00:32 |
− | | JDK 1.7 | + | | '''JDK 1.7''' |
|- | |- | ||
− | | 00 | + | | 00:34 |
− | | Firefox web-browser 21.0 | + | | '''Firefox''' web-browser '''21.0''' |
|- | |- | ||
− | | 00 | + | | 00:38 |
|You can use any web-browser of your choice. | |You can use any web-browser of your choice. | ||
|- | |- | ||
− | | 00 | + | | 00:42 |
− | | To follow this tutorial you must have knowledge of | + | | To follow this tutorial, you must have knowledge of: |
|- | |- | ||
− | | 00 | + | | 00:45 |
| Basics of '''Java Servlets '''and '''JSPs''' | | Basics of '''Java Servlets '''and '''JSPs''' | ||
|- | |- | ||
− | | 00 | + | | 00:50 |
− | | Database and validation of fields | + | | Database and validation of '''fields'''. |
|- | |- | ||
− | | 00 | + | | 00:53 |
|If not, for relevant tutorials please visit our website. | |If not, for relevant tutorials please visit our website. | ||
|- | |- | ||
− | | 00 | + | | 00:57 |
− | | Now, let us switch to '''NetBeans IDE ''' | + | | Now, let us switch to '''NetBeans IDE '''. |
|- | |- | ||
− | | 01 | + | | 01:01 |
| I have created the '''Books table.''' | | I have created the '''Books table.''' | ||
|- | |- | ||
− | | 01 | + | | 01:04 |
− | |You can see the different fields in the table | + | |You can see the different '''fields''' in the '''table'''. |
|- | |- | ||
− | | 01 | + | | 01:08 |
|I have inserted '''10 books '''into this '''table.''' | |I have inserted '''10 books '''into this '''table.''' | ||
|- | |- | ||
− | | 01 | + | | 01:12 |
| I have created '''Checkout''' table to store borrowed books. | | I have created '''Checkout''' table to store borrowed books. | ||
|- | |- | ||
− | | 01 | + | | 01:18 |
− | |I have inserted 5 entries into Checkout table. | + | |I have inserted 5 entries into the '''Checkout''' table. |
|- | |- | ||
− | |01 | + | |01:24 |
|I have also created a '''model '''for '''Book '''and '''Checkout.''' | |I have also created a '''model '''for '''Book '''and '''Checkout.''' | ||
|- | |- | ||
− | |01 | + | |01:29 |
− | |Book.java '''is a book model. | + | |'''Book.java''' is a book model. |
|- | |- | ||
− | | 01 | + | | 01:32 |
− | |And '''Checkout.java '''is a checkout model. | + | |And '''Checkout.java''' is a checkout model. |
|- | |- | ||
− | | 01 | + | | 01:37 |
| Now, come to the browser. | | Now, come to the browser. | ||
|- | |- | ||
− | | 01 | + | | 01:40 |
| Let us login as the '''admin.''' | | Let us login as the '''admin.''' | ||
|- | |- | ||
− | |01 | + | |01:43 |
− | | So I will type the username and password''' as admin. '''Then click on '''Sign In.''' | + | | So, I will type the '''username''' and '''password''' as '''admin.''' Then click on '''Sign In.''' |
|- | |- | ||
− | | 01 | + | | 01:51 |
| We can see that we come to the '''Admin Section Page.''' | | We can see that we come to the '''Admin Section Page.''' | ||
|- | |- | ||
− | |01 | + | |01:55 |
− | |We will come back to this page. Now let us switch to '''Netbeans IDE. ''' | + | |We will come back to this page. Now let us switch to '''Netbeans IDE.''' |
|- | |- | ||
− | | 02 | + | | 02:02 |
− | |We will see | + | |We will see, how we modified the '''GreetingServlet '''to redirect to '''Admin Page.''' |
|- | |- | ||
− | | 02 | + | | 02:08 |
| Let us see the '''GreetingServlet.java.''' | | Let us see the '''GreetingServlet.java.''' | ||
|- | |- | ||
− | |02 | + | |02:13 |
− | | Here we check if '''username''' and '''password ''' | + | | Here we check if '''username''' and '''password '''equal '''admin.''' |
|- | |- | ||
− | | 02 | + | | 02:19 |
|If yes, then we redirect to '''adminsection.jsp.''' | |If yes, then we redirect to '''adminsection.jsp.''' | ||
|- | |- | ||
− | | 02 | + | | 02:25 |
|We have already seen how to forward to another page using '''RequestDispatcher.''' | |We have already seen how to forward to another page using '''RequestDispatcher.''' | ||
|- | |- | ||
− | | 02 | + | | 02:32 |
|Now, switch back to the '''browser.''' | |Now, switch back to the '''browser.''' | ||
|- | |- | ||
− | |02 | + | |02:35 |
|We have two options here. | |We have two options here. | ||
|- | |- | ||
− | |02 | + | |02:37 |
| We will click on the '''radio button '''for '''List Books.''' | | We will click on the '''radio button '''for '''List Books.''' | ||
|- | |- | ||
− | | 02 | + | | 02:41 |
|Then click on '''Submit button.''' | |Then click on '''Submit button.''' | ||
|- | |- | ||
− | | 02 | + | | 02:44 |
|Here, we can see that we have the '''list '''of all the '''Books.''' | |Here, we can see that we have the '''list '''of all the '''Books.''' | ||
|- | |- | ||
− | | 02 | + | | 02:49 |
− | |It has all the details like '''Book Id, | + | |It has all the details like- '''Book Id, Book Name, Author Name, ISBN, Publisher, Total Copies''' and '''Available copies.''' |
|- | |- | ||
− | |02 | + | |02:59 |
− | |Now I will show you how this is done. | + | |Now, I will show you how this is done. |
|- | |- | ||
− | | 03 | + | | 03:03 |
| Switch back to the '''IDE.''' | | Switch back to the '''IDE.''' | ||
|- | |- | ||
− | | 03 | + | | 03:05 |
− | | Now, let us come to '''adminsection | + | | Now, let us come to '''adminsection ''' dot '''jsp.''' |
|- | |- | ||
− | |03 | + | |03:10 |
| Here we have two '''radio buttons.''' | | Here we have two '''radio buttons.''' | ||
|- | |- | ||
− | |03 | + | |03:14 |
| The first one is to '''list '''all the '''books.''' | | The first one is to '''list '''all the '''books.''' | ||
|- | |- | ||
− | | 03 | + | | 03:19 |
− | | We can see that in '''adminsection | + | | We can see that in '''adminsection ''' dot '''jsp''', we have '''form action ''' equal to '''AdminSection'''. |
|- | |- | ||
− | | 03 | + | | 03:28 |
− | | Now, Open '''AdminSection | + | | Now, Open '''AdminSection ''' dot '''java.''' |
|- | |- | ||
− | | 03 | + | | 03:32 |
|Here, this checks the option that we click on. | |Here, this checks the option that we click on. | ||
|- | |- | ||
− | | 03 | + | | 03:36 |
− | |We clicked on List Books. | + | |We clicked on '''List Books'''. |
|- | |- | ||
− | | 03 | + | | 03:39 |
− | | So this part of the query will be executed. | + | | So, this part of the query will be executed. |
|- | |- | ||
− | | 03 | + | | 03:44 |
− | |We execute query to fetch books from '''Books table.''' | + | |We execute the query to fetch books from '''Books table.''' |
|- | |- | ||
− | | 03 | + | | 03:49 |
− | |Next we create '''ArrayList''' to store the details of the books | + | |Next, we create '''ArrayList''' to store the details of the books. |
|- | |- | ||
− | | 03 | + | | 03:55 |
− | | Then we iterate through the '''result set''' | + | | Then we iterate through the '''result set'''. |
|- | |- | ||
− | | 03 | + | | 03:59 |
− | |We create the '''Book''' object | + | |We create the '''Book''' object. |
|- | |- | ||
− | |04 | + | |04:03 |
− | | We set '''BookId '''into the '''Book '''object | + | | We set '''BookId '''into the '''Book '''object. |
|- | |- | ||
− | | 04 | + | | 04:08 |
− | |Similarly we set other attributes of the book into '''Book ''' | + | |Similarly, we set other attributes of the book into the '''Book '''object. |
|- | |- | ||
− | |04 | + | |04:16 |
| Then we add '''book '''object into the '''books '''list. | | Then we add '''book '''object into the '''books '''list. | ||
|- | |- | ||
− | | 04 | + | | 04:21 |
| Then we set the '''ArrayList books''' into the '''request.''' | | Then we set the '''ArrayList books''' into the '''request.''' | ||
|- | |- | ||
− | | 04 | + | | 04:26 |
− | | Then we forward the '''request '''to '''listBooks.jsp '''using '''RequestDispatcher''' | + | | Then we forward the '''request '''to '''listBooks.jsp '''using '''RequestDispatcher'''. |
|- | |- | ||
− | | 04 | + | | 04:33 |
− | | Now we come to '''listBooks.jsp''' | + | | Now, we come to '''listBooks.jsp'''. |
|- | |- | ||
− | | 04 | + | | 04:38 |
− | |In this page '''admin '''can view list of books. | + | |In this page, '''admin '''can view the list of books. |
|- | |- | ||
− | | | + | | 04:43 |
− | | Here, first we obtain the '''books''' from '''request'''. | + | | Here, first we obtain the '''books''' from the '''request'''. |
|- | |- | ||
− | |04 | + | |04:48 |
− | + | | This '''HTML table''' will display the details of the books. | |
− | | This '''HTML table''' will display details of the books. | + | |
|- | |- | ||
− | | 04 | + | | 04:54 |
− | | So we will iterate through the book list. | + | | So, we will iterate through the '''book list'''. |
|- | |- | ||
− | | 04 | + | | 04:58 |
| Here we display the '''BookId''' of the book. | | Here we display the '''BookId''' of the book. | ||
|- | |- | ||
− | | 05 | + | | 05:02 |
− | | Similarly we display other attributes of the book. | + | | Similarly, we display other attributes of the book. |
|- | |- | ||
− | | 05 | + | | 05:07 |
| This is how we display the list of books. | | This is how we display the list of books. | ||
|- | |- | ||
− | | 05 | + | | 05:11 |
| Now, switch back to the '''browser'''. | | Now, switch back to the '''browser'''. | ||
|- | |- | ||
− | | 05 | + | | 05:14 |
− | | Click on '''List | + | | Click on '''List Borrowed Books.''' |
|- | |- | ||
− | | 05 | + | | 05:17 |
− | |And ''' | + | |And click on the '''Submit button.''' |
|- | |- | ||
− | |05 | + | |05:20 |
− | |We see a '''list '''of all the '''Books ''' | + | |We see a '''list '''of all the '''Books issued'''. |
|- | |- | ||
− | | 05 | + | | 05:24 |
|It has details like '''Transaction Id, Book Id '''and '''Username.''' | |It has details like '''Transaction Id, Book Id '''and '''Username.''' | ||
|- | |- | ||
− | | 05 | + | | 05:29 |
− | | Now,I will switch back to the '''IDE | + | | Now, I will switch back to the '''IDE''' |
|- | |- | ||
− | | 05 | + | | 05:32 |
− | | | + | |and show you the code for the same. |
|- | |- | ||
− | | 05 | + | | 05:35 |
| Go to '''AdminSection.java.''' | | Go to '''AdminSection.java.''' | ||
|- | |- | ||
− | | 05 | + | | 05:38 |
| We had clicked on '''List Borrowed Books.''' | | We had clicked on '''List Borrowed Books.''' | ||
|- | |- | ||
− | | 05 | + | | 05:42 |
|So''' menuSelection '''is equal to '''List Borrowed books.''' | |So''' menuSelection '''is equal to '''List Borrowed books.''' | ||
|- | |- | ||
− | |05 | + | |05:47 |
|The steps are similar to what we saw for '''List Books.''' | |The steps are similar to what we saw for '''List Books.''' | ||
|- | |- | ||
− | | 05 | + | | 05:53 |
|We execute the query to fetch borrowed books details from the '''Checkout table.''' | |We execute the query to fetch borrowed books details from the '''Checkout table.''' | ||
|- | |- | ||
− | | 05 | + | | 05:59 |
− | |Then we iterate through the borrowed books | + | |Then we iterate through the '''borrowed books''' |
|- | |- | ||
− | | 06 | + | | 06:02 |
− | | | + | |and set it into '''request''' as '''checkout '''attribute. |
|- | |- | ||
− | | 06 | + | | 06:07 |
− | |Now we come to '''listBorrowedBooks.jsp''' | + | |Now, we come to '''listBorrowedBooks.jsp'''. |
|- | |- | ||
− | | 06 | + | | 06:12 |
| Here we obtain '''checkout''' from the '''request'''. | | Here we obtain '''checkout''' from the '''request'''. | ||
|- | |- | ||
− | |06 | + | |06:17 |
− | | We iterate through the '''Checkout''' list | + | | We iterate through the '''Checkout''' list |
|- | |- | ||
− | | 06 | + | | 06:20 |
− | | | + | |and here we display the attributes of the '''Checkout.''' |
|- | |- | ||
− | | 06 | + | | 06:25 |
| This is how we display '''Borrowed Books.''' | | This is how we display '''Borrowed Books.''' | ||
|- | |- | ||
− | | 06 | + | | 06:28 |
− | | Now, switch back to the | + | | Now, switch back to the browser. |
|- | |- | ||
− | | 06 | + | | 06:30 |
− | | In the borrowed books page we have one more '''list | + | | In the '''borrowed books page''', we have one more '''list'''. |
|- | |- | ||
− | | 06 | + | | 06:36 |
− | |The '''list '''of '''books ''' | + | |The '''list '''of '''books issued''' when the '''current date '''is more than the '''return date.''' |
|- | |- | ||
− | | 06 | + | | 06:43 |
| Switch back to '''IDE '''to see the code. | | Switch back to '''IDE '''to see the code. | ||
|- | |- | ||
− | | 06 | + | | 06:46 |
| This is done in the same way as we did for '''Borrowed Books.''' | | This is done in the same way as we did for '''Borrowed Books.''' | ||
|- | |- | ||
− | | 06 | + | | 06:50 |
| The only difference is in the '''SQL query.''' | | The only difference is in the '''SQL query.''' | ||
|- | |- | ||
− | | 06 | + | | 06:56 |
− | |In the query we give the condition | + | |In the query, we give the condition: '''return_date less than now() order by transaction_Id.''' |
|- | |- | ||
− | | 07 | + | | 07:05 |
− | | Now I will show you the interface for a normal user. | + | | Now, I will show you the '''interface''' for a normal user. |
|- | |- | ||
− | | 07 | + | | 07:10 |
− | | | + | | Switch back to the '''browser.''' |
|- | |- | ||
− | | 07 | + | | 07:12 |
| Come back to the '''login page.''' | | Come back to the '''login page.''' | ||
|- | |- | ||
− | | 07 | + | | 07:15 |
| I will login as '''mdhusein.''' | | I will login as '''mdhusein.''' | ||
|- | |- | ||
− | | 07 | + | | 07:20 |
− | | Type the password as '''welcome | + | | Type the password as '''welcome''' |
|- | |- | ||
− | | 07 | + | | 07:22 |
− | | | + | | and click on '''Sign In.''' |
|- | |- | ||
− | |07 | + | |07:25 |
| We get a '''Success Greeting Page.''' | | We get a '''Success Greeting Page.''' | ||
|- | |- | ||
− | | 07 | + | | 07:28 |
− | | It has the | + | | It has the books currently borrowed by the '''user.''' |
|- | |- | ||
− | | 07 | + | | 07:32 |
|It has details like '''Transaction Id, User Name, Book Id '''and '''Return Date.''' | |It has details like '''Transaction Id, User Name, Book Id '''and '''Return Date.''' | ||
|- | |- | ||
− | | 07 | + | | 07:39 |
| Now, let us come back to the '''IDE.''' | | Now, let us come back to the '''IDE.''' | ||
|- | |- | ||
− | | 07 | + | | 07:43 |
− | | Now we go to '''GreetingServlet.java''' | + | | Now we go to '''GreetingServlet.java'''. |
|- | |- | ||
− | | 07 | + | | 07:47 |
− | | We display the books issued in same way as we did for the admin. | + | | We display the books issued in the same way as we did for the admin. |
|- | |- | ||
− | | 07 | + | | 07:53 |
|Here the difference will be that we have to display the books for the logged in user. | |Here the difference will be that we have to display the books for the logged in user. | ||
|- | |- | ||
− | | 08 | + | | 08:02 |
− | | So I get the username from this line. | + | | So, I get the '''username''' from this line. |
|- | |- | ||
− | |08 | + | |08:05 |
− | | Then we fetch the details of borrowed books | + | | Then we fetch the details of borrowed books |
|- | |- | ||
− | | 08 | + | | 08:10 |
− | | | + | |with the condition '''username''' is equal to the logged-in user. |
|- | |- | ||
− | | 08 | + | | 08:14 |
| So, we get the list of books issued for the corresponding user. | | So, we get the list of books issued for the corresponding user. | ||
|- | |- | ||
− | | 08 | + | | 08:20 |
− | |Then in '''successGreeting ''dot ''jsp '''we will display the list. | + | |Then, in '''successGreeting ''dot ''jsp '''we will display the list. |
|- | |- | ||
− | | 08 | + | | 08:27 |
|This is how your '''successGreeting dot jsp '''will look. | |This is how your '''successGreeting dot jsp '''will look. | ||
|- | |- | ||
− | | 08 | + | | 08:32 |
− | | In this tutorial we have learnt to: | + | | In this tutorial, we have learnt to: |
|- | |- | ||
− | | 08 | + | | 08:35 |
− | | Modify the login page to redirect to admin page | + | | Modify the '''login page''' to redirect to '''admin page''' |
|- | |- | ||
− | | 08 | + | | 08:39 |
− | | To fetch | + | | To fetch the book details |
|- | |- | ||
− | | 08 | + | | 08:42 |
− | | To fetch borrowed book details | + | | To fetch the borrowed book details and |
|- | |- | ||
− | | 08 | + | | 08:45 |
− | | | + | | To display the books borrowed by a logged in user. |
|- | |- | ||
− | |08 | + | |08:50 |
| To know more about the spoken tutorial project, watch the video available at the following link. | | To know more about the spoken tutorial project, watch the video available at the following link. | ||
|- | |- | ||
− | | 08 | + | | 08:56 |
− | | It summarizes the Spoken Tutorial | + | | It summarizes the Spoken Tutorial project. |
|- | |- | ||
− | | 08 | + | | 08:59 |
− | | If you do not have good bandwidth you can download and watch it | + | | If you do not have good bandwidth, you can download and watch it. |
|- | |- | ||
− | | 09 | + | | 09:04 |
− | | The Spoken Tutorial Project | + | | The Spoken Tutorial Project team: |
|- | |- | ||
− | | 09 | + | | 09:06 |
− | | Conducts workshops using spoken tutorials | + | | Conducts workshops using spoken tutorials. |
|- | |- | ||
− | | 09 | + | | 09:09 |
− | | Gives certificates to those who pass an online test | + | | Gives certificates to those who pass an online test. |
|- | |- | ||
− | | 09 | + | | 09:13 |
− | | For more details please write to contact at spoken hyphen tutorial dot org | + | | For more details, please write to contact at spoken hyphen tutorial dot org. |
|- | |- | ||
− | | 09 | + | | 09:20 |
− | |Spoken Tutorial Project is a part of the Talk to a Teacher Project | + | |Spoken Tutorial Project is a part of the "Talk to a Teacher" Project. |
|- | |- | ||
− | | 09 | + | | 09:24 |
− | | It is supported by the National Mission on Education through ICT, MHRD, Government of India | + | | It is supported by the National Mission on Education through ICT, MHRD, Government of India. |
|- | |- | ||
− | | 09 | + | | 09:30 |
| More information on this mission is available at http://spoken-tutorial.org/NMEICT-Intro | | More information on this mission is available at http://spoken-tutorial.org/NMEICT-Intro | ||
− | |||
− | |||
|- | |- | ||
− | | 09 | + | | 09:40 |
− | | The Library Management System has been contributed by a leading software MNC | + | | The '''Library Management System''' has been contributed by a leading software MNC through their '''Corporate Social Responsibility Program'''. |
|- | |- | ||
− | | 09 | + | | 09:49 |
|They have also validated the content for this spoken tutorial. | |They have also validated the content for this spoken tutorial. | ||
|- | |- | ||
− | | 09 | + | | 09:53 |
− | |This is Arya Ratish from IIT Bombay signing off. | + | |This is Arya Ratish from IIT Bombay, signing off. |
|- | |- | ||
− | | 09 | + | | 09:57 |
|Thank you for joining. | |Thank you for joining. | ||
|} | |} |
Latest revision as of 16:13, 28 March 2017
Time | Narration |
00:01 | Welcome to the spoken-tutorial on Creating and viewing inventories. |
00:07 | In this tutorial, we will learn: |
00:09 | To modify the login page to redirect to admin page |
00:14 | To fetch all the book details |
00:17 | To fetch borrowed book details |
00:20 | To display the books borrowed by a logged in user. |
00:25 | Here we are using: |
00:27 | Ubuntu Version 12.04 |
00:29 | Netbeans IDE 7.3 |
00:32 | JDK 1.7 |
00:34 | Firefox web-browser 21.0 |
00:38 | You can use any web-browser of your choice. |
00:42 | To follow this tutorial, you must have knowledge of: |
00:45 | Basics of Java Servlets and JSPs |
00:50 | Database and validation of fields. |
00:53 | If not, for relevant tutorials please visit our website. |
00:57 | Now, let us switch to NetBeans IDE . |
01:01 | I have created the Books table. |
01:04 | You can see the different fields in the table. |
01:08 | I have inserted 10 books into this table. |
01:12 | I have created Checkout table to store borrowed books. |
01:18 | I have inserted 5 entries into the Checkout table. |
01:24 | I have also created a model for Book and Checkout. |
01:29 | Book.java is a book model. |
01:32 | And Checkout.java is a checkout model. |
01:37 | Now, come to the browser. |
01:40 | Let us login as the admin. |
01:43 | So, I will type the username and password as admin. Then click on Sign In. |
01:51 | We can see that we come to the Admin Section Page. |
01:55 | We will come back to this page. Now let us switch to Netbeans IDE. |
02:02 | We will see, how we modified the GreetingServlet to redirect to Admin Page. |
02:08 | Let us see the GreetingServlet.java. |
02:13 | Here we check if username and password equal admin. |
02:19 | If yes, then we redirect to adminsection.jsp. |
02:25 | We have already seen how to forward to another page using RequestDispatcher. |
02:32 | Now, switch back to the browser. |
02:35 | We have two options here. |
02:37 | We will click on the radio button for List Books. |
02:41 | Then click on Submit button. |
02:44 | Here, we can see that we have the list of all the Books. |
02:49 | It has all the details like- Book Id, Book Name, Author Name, ISBN, Publisher, Total Copies and Available copies. |
02:59 | Now, I will show you how this is done. |
03:03 | Switch back to the IDE. |
03:05 | Now, let us come to adminsection dot jsp. |
03:10 | Here we have two radio buttons. |
03:14 | The first one is to list all the books. |
03:19 | We can see that in adminsection dot jsp, we have form action equal to AdminSection. |
03:28 | Now, Open AdminSection dot java. |
03:32 | Here, this checks the option that we click on. |
03:36 | We clicked on List Books. |
03:39 | So, this part of the query will be executed. |
03:44 | We execute the query to fetch books from Books table. |
03:49 | Next, we create ArrayList to store the details of the books. |
03:55 | Then we iterate through the result set. |
03:59 | We create the Book object. |
04:03 | We set BookId into the Book object. |
04:08 | Similarly, we set other attributes of the book into the Book object. |
04:16 | Then we add book object into the books list. |
04:21 | Then we set the ArrayList books into the request. |
04:26 | Then we forward the request to listBooks.jsp using RequestDispatcher. |
04:33 | Now, we come to listBooks.jsp. |
04:38 | In this page, admin can view the list of books. |
04:43 | Here, first we obtain the books from the request. |
04:48 | This HTML table will display the details of the books. |
04:54 | So, we will iterate through the book list. |
04:58 | Here we display the BookId of the book. |
05:02 | Similarly, we display other attributes of the book. |
05:07 | This is how we display the list of books. |
05:11 | Now, switch back to the browser. |
05:14 | Click on List Borrowed Books. |
05:17 | And click on the Submit button. |
05:20 | We see a list of all the Books issued. |
05:24 | It has details like Transaction Id, Book Id and Username. |
05:29 | Now, I will switch back to the IDE |
05:32 | and show you the code for the same. |
05:35 | Go to AdminSection.java. |
05:38 | We had clicked on List Borrowed Books. |
05:42 | So menuSelection is equal to List Borrowed books. |
05:47 | The steps are similar to what we saw for List Books. |
05:53 | We execute the query to fetch borrowed books details from the Checkout table. |
05:59 | Then we iterate through the borrowed books |
06:02 | and set it into request as checkout attribute. |
06:07 | Now, we come to listBorrowedBooks.jsp. |
06:12 | Here we obtain checkout from the request. |
06:17 | We iterate through the Checkout list |
06:20 | and here we display the attributes of the Checkout. |
06:25 | This is how we display Borrowed Books. |
06:28 | Now, switch back to the browser. |
06:30 | In the borrowed books page, we have one more list. |
06:36 | The list of books issued when the current date is more than the return date. |
06:43 | Switch back to IDE to see the code. |
06:46 | This is done in the same way as we did for Borrowed Books. |
06:50 | The only difference is in the SQL query. |
06:56 | In the query, we give the condition: return_date less than now() order by transaction_Id. |
07:05 | Now, I will show you the interface for a normal user. |
07:10 | Switch back to the browser. |
07:12 | Come back to the login page. |
07:15 | I will login as mdhusein. |
07:20 | Type the password as welcome |
07:22 | and click on Sign In. |
07:25 | We get a Success Greeting Page. |
07:28 | It has the books currently borrowed by the user. |
07:32 | It has details like Transaction Id, User Name, Book Id and Return Date. |
07:39 | Now, let us come back to the IDE. |
07:43 | Now we go to GreetingServlet.java. |
07:47 | We display the books issued in the same way as we did for the admin. |
07:53 | Here the difference will be that we have to display the books for the logged in user. |
08:02 | So, I get the username from this line. |
08:05 | Then we fetch the details of borrowed books |
08:10 | with the condition username is equal to the logged-in user. |
08:14 | So, we get the list of books issued for the corresponding user. |
08:20 | Then, in successGreeting dot jsp we will display the list. |
08:27 | This is how your successGreeting dot jsp will look. |
08:32 | In this tutorial, we have learnt to: |
08:35 | Modify the login page to redirect to admin page |
08:39 | To fetch the book details |
08:42 | To fetch the borrowed book details and |
08:45 | To display the books borrowed by a logged in user. |
08:50 | To know more about the spoken tutorial project, watch the video available at the following link. |
08:56 | It summarizes the Spoken Tutorial project. |
08:59 | If you do not have good bandwidth, you can download and watch it. |
09:04 | The Spoken Tutorial Project team: |
09:06 | Conducts workshops using spoken tutorials. |
09:09 | Gives certificates to those who pass an online test. |
09:13 | For more details, please write to contact at spoken hyphen tutorial dot org. |
09:20 | Spoken Tutorial Project is a part of the "Talk to a Teacher" Project. |
09:24 | It is supported by the National Mission on Education through ICT, MHRD, Government of India. |
09:30 | More information on this mission is available at http://spoken-tutorial.org/NMEICT-Intro |
09:40 | The Library Management System has been contributed by a leading software MNC through their Corporate Social Responsibility Program. |
09:49 | They have also validated the content for this spoken tutorial. |
09:53 | This is Arya Ratish from IIT Bombay, signing off. |
09:57 | Thank you for joining. |