Statistics
47
Views
0
Downloads
0
Donations
Support
Share
Uploader

高宏飞

Shared on 2026-01-27

AuthorSarika Agarwal, Vivek Gupta

This book is about creating web applications with Java, servlets, Java Server Pages, and struts. Servlets, JSP pages, and database connectivity will be covered in detail. The more you read this book, the better you will be at making GUI apps, using JavaBeans in JSP, and making your tag libraries. The book covers various key topics, including the MVC pattern, servlets, JSP, database connectivity, struts, and localization. With examples and demonstrations, you'll learn about every aspect of web development and how to use Java and associated tools effectively throughout the process. All programmes are made in the NetBeans IDE and run on Tomcat Server. The hierarchy of classes and the architecture are also illustrated graphically. Readers will get comprehensive knowledge of concepts through analogies drawn from real-world situations. Interview questions with solutions are also included for users looking for jobs in software companies. Readers will be able to create dynamic websites and blogs with the help of this book. The book is a wonderful resource for aspiring java programmers and web developers who wish to master both basic and advanced level web application development in Java through their efforts and this book. What you will learn ● Connect to a database using a thin driver. ● Create GUI apps, reuse JavaBeans in JSP, and custom tag libraries. ● Discover how to run a Tomcat server. ● Acquaint with the NetBeans IDE and create all applications using it. ● Explore solutions on Java programming to get ready for the workplace.

Tags
No tags
ISBN: 9355511434
Publisher: BPB Publications
Publish Year: 2022
Language: 英文
Pages: 235
File Format: PDF
File Size: 5.4 MB
Support Statistics
¥.00 · 0times
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

(This page has no text content)
Java for Web Development Create Full-Stack Java Applications with Servlets, JSP Pages, MVC Pattern and Database Connectivity Sarika Agarwal Vivek Gupta www.bpbonline.com
FIRST EDITION 2022 Copyright © BPB Publications, India ISBN: 978-93-55511-430 All Rights Reserved. No part of this publication may be reproduced, distributed or transmitted in any form or by any means or stored in a database or retrieval system, without the prior written permission of the publisher with the exception to the program listings which may be entered, stored and executed in a computer system, but they can not be reproduced by the means of publication, photocopy, recording, or by any electronic and mechanical means. LIMITS OF LIABILITY AND DISCLAIMER OF WARRANTY The information contained in this book is true to correct and the best of author’s and publisher’s knowledge. The author has made every effort to ensure the accuracy of these publications, but publisher cannot be held responsible for any loss or damage arising from any information in this book. All trademarks referred to in the book are acknowledged as properties of their respective owners but BPB Publications cannot guarantee the accuracy of this information. Distributors: BPB PUBLICATIONS 20, Ansari Road, Darya Ganj New Delhi-110002 Ph: 23254990/23254991 MICRO MEDIA Shop No. 5, Mahendra Chambers, 150 DN Rd. Next to Capital Cinema, V.T. (C.S.T.) Station, MUMBAI-400 001 Ph: 22078296/22078297 DECCAN AGENCIES 4-3-329, Bank Street, Hyderabad-500195 Ph: 24756967/24756400 BPB BOOK CENTRE 376 Old Lajpat Rai Market, Delhi-110006 Ph: 23861747
Published by Manish Jain for BPB Publications, 20 Ansari Road, Darya Ganj, New Delhi-110002 and Printed by him at Repro India Ltd, Mumbai www.bpbonline.com
Dedicated to My beloved Son Mr. Kushagra Agarwal
About the Authors Sarika Agarwal is a professor with 16+ years of experience teaching Java technology Python. She has imparted training on Java, Python, C, C++ for more than 5000 students. Her interest area is Java, Android, machine learning, Natural Language Processing. She has cleared many certifications, including SCJP (Sun Certified Java Programmer), OWCD (Oracle Web component Developer), ACAD (Android Certified Application Developer), Android ATC Certified Trainer, MTA certifications (Software Testing Fundamentals, Operating System, Database Management System), IBM RAD certification. She has worked in NIIT as a Java Faculty and Engineering College professor. She has published papers in Journals and Scopus Index conferences. She is the author of the Book -Java in Depth. Vivek Gupta has completed his B.Tech from Uttar Pradesh Technical University in 2006 CDAC (Post Graduate Diploma in Computer Science) in 2006. 15+ years of experience in Java Application support and maintenance at all levels (L1, L2, and L3). Currently, working with Ventiv Technology as Technical Lead. He has worked in HCL, Cognizant Technology Solutions
About the Reviewer With about six years of experience in teaching, Ms. Jyoti Kumari is an Assistant Professor, an enthusiast in learning new technologies. She currently works at Keshav Mahavidyalaya, University of Delhi. She is also pursuing a Ph.D. in Information Technology at Amity University to carry her interest in research work. She also mentors graduate students in their project work such as creating android applications, web development, and so on. She was also a member of the editorial board of the magazine of the technical society of Computer Science department of the college.
Acknowledgement There are a few people I want to thank for the continued and ongoing support they have given me during the writing of this book. First and foremost, I would like to thank my husband, Mr. Amit Kumar, for continuous support and encouraging me to write the book — I could have never completed this book without his support. I am grateful to the excellent Java Community, from which I have learned and continue to learn a great deal. I would like to thank the reviewers who contributed many suggestions and improvements to my drafts. Thanks also go to many others with whom I have had conversations or email discussions over the course of writing the book. Any errors that remain are, of course, to be laid at my door. Special thanks to BPB Publications team, for the valuable support provided throughout the entire process. Finally, the writing of this book has been a great deal of work, and I could not have done it without the constant support of my family. My son, Kushagra Agarwal, has been very understanding, and I am looking forward to spending lots more time with all of them.
Preface Java, the only pure object-oriented language available today, is now used in almost all applications, from simple home appliances control systems to complex space control systems. It has also revolutionized applications from Intranet to the Internet. This book aims at imparting expertise in web application development using servlets and JavaServer Pages. You will learn to create a servlet, JSP pages, and connectivity with Database and deploy these applications on the Tomcat Server. Some Interview Questions with answers are also included. This book is meant for anyone who has an interest in Object-Oriented Programming and is aspiring to become a Java Programmer. The book covers all topics with basic examples and analogies. The book covers all topics related to Servlets and JSP like building GUI applications, reusing JavaBeans in JSP, and using custom tag libraries. This book is written to serve as a textbook for GBTU and for those who want to learn basic and advanced level web application development in java with their efforts. In each chapter, good worked Examples have been given. Chapter 1 aims to learn the connectivity of the Java Program with the Database; Chapter 2 covers Internationalization, which customizes an application according to specific languages and regions. Chapter 3 to 6 covers the Servlets, Inter Servlet Communications Sessions, etc. Chapter 7 to 10 Covers topics related to JSP pages, Custom tags, Directives, MVC architecture, and many more At the end of each chapter, some interview questions with answers are also given that may be useful to students of any discipline as MCA, B.Tech, M.Tech, M.Sc. I am sure that the students and the faculty will find this book very useful.
Critical evaluation and suggestions for improving the book will be highly appreciated and gratefully acknowledged.
Code Bundle and Coloured Images Please follow the link to download the Code Bundle and the Coloured Images of the book: https://rebrand.ly/0a0b7b The code bundle for the book is also hosted on GitHub at https://github.com/bpbpublications/Java-for-Web-Development. In case there's an update to the code, it will be updated on the existing GitHub repository. We have code bundles from our rich catalogue of books and videos available at https://github.com/bpbpublications. Check them out! Errata We take immense pride in our work at BPB Publications and follow best practices to ensure the accuracy of our content to provide with an indulging reading experience to our subscribers. Our readers are our mirrors, and we use their inputs to reflect and improve upon human errors, if any, that may have occurred during the publishing processes involved. To let us maintain the quality and help us reach out to any readers who might be having difficulties due to any unforeseen errors, please write to us at : errata@bpbonline.com Your support, suggestions and feedbacks are highly appreciated by the BPB Publications’ Family. Did you know that BPB offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.bpbonline.com and as a print book customer,
you are entitled to a discount on the eBook copy. Get in touch with us at : business@bpbonline.com for more details. At www.bpbonline.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on BPB books and eBooks.
Piracy If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at business@bpbonline.com with a link to the material. If you are interested in becoming an author If there is a topic that you have expertise in, and you are interested in either writing or contributing to a book, please visit www.bpbonline.com. We have worked with thousands of developers and tech professionals, just like you, to help them share their insights with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea. Reviews Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions. We at BPB can understand what you think about our products, and our authors can see your feedback on their book. Thank you! For more information about BPB, please visit www.bpbonline.com.
Table of Contents 1. Database Connectivity Introduction Structure Objectives Database Management ODBC Application Programming Interface (API) JDBC-API Categories of JDBC Drivers JDBC-ODBC bridge + ODBC driver Native-API driver Network protocol driver Thin Driver Querying a database Connecting to a database The connection object Loading the Driver and establishing the connection The JDBC URL A Sample JDBC URL Processing querying in a database Conclusion Multiple Choice Questions Answers Fill in the blanks
State True/False Questions Interview Questions 2. Internationalization (I18N) Introduction Structure Objective Localization (L10N) Locale Constructors of Locale Class Commonly used methods of Locale class Resource Bundle Constructor of ResourceBundle Methods of ResourceBundle Class Steps to develop the I18N-based application Internationalizing Date and Time (I18N with Date and Time) Methods of java.text.DateFormat Internationalizing with Numbers (I18N with Numbers) Conclusion Multiple Choice Questions 3. Introduction to Java Servlets Introduction Structure Objectives Webserver
Introduction to Servlets Characteristics of Servlets Comparison between Servlets and Applets Comparison between Servlets and other server-side scripting technologies CGI scripts Active Server Pages (ASP) Working of Servlets The GET and POST methods The Javax.servlet package Lifecycle of a Servlet Servlet Interface Creating a Servlet Creating the deployment descriptor (web.xml file) Conclusion Questions 4. HTTP Servlet Introduction Structure Objectives HTTP Servlet Need of HTTPServlet class HTTP Request and HTTP Response The GET and POST methods HttpServletRequest Interface Method of ServletRequest Interface Conclusion
Questions Multiple Choice Questions 5. Working with Servlet Sessions Introduction Structure Objective Session tracking Techniques to keep track of sessions in servlets URL Rewriting Hidden Form Fields Using the HttpSession Interface Cookies The javax.servlet.http.Cookie class Conclusion Questions 6. Inter-Servlet Communication Introduction Structure The RequestDispatcher Interface Method of ServletContext Interface Method to get the object of RequestDispatcher Methods of RequestDispatcher interface Implementing Inter servlet communication via a problem statement Tasklist Client Interface index.xhtml Code of FirstServlet
SendRedirect Difference between forward() and sendRedirect() method Conclusion Questions 7. Java Server Pages(JSP) Introduction Structure Objectives Need for JSP Difference between Servlet and JSP Advantages of JSP The JSP request-response cycle Lifecycle of JSP Structure of a JSP Page The directory structure of the JSP Page Conclusion Questions 8. Comment Tag and Scripting Element Structure Objectives JSP Elements Comment Tag Scripting Elements Scriptlet tag Expression Tag Declaration tag Implicit Objects
Conclusion Questions Select the Correct Option 9. JSP Directives Structure Objective Types Of Directives JSP directives The page directive Implicit Objects contentType extends errorPage isErrorPage import= “package list” language= “scripting language.” Session=true/false info= “servlet information” Buffer isELIgnored= “true/false” isThreadSafe autoFlush The include directive The Taglib directive Conclusion Questions 10. JSP Action Element and Custom Tags
Introduction Structure Objectives JSP Action Tags jsp:useBean action tag jsp:setProperty and jsp:getProperty action tags Jsp:forward action tag jsp:include action tag JSP custom tags Custom Tag Library Need of XML Custom Tags The structure of the TLD file The structure of the JSP File Expression Language(EL) Model View Controller (MVC) Architecture in JSP MVC Example in JSP Conclusion Questions 11. Introduction to Struts Introduction Structure Objective Features of Struts2 Components of Struts2 Architecture of Struts2 Creating a Struts Application