Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Java EE 8 Development with Eclipse. - Third Edition

You're reading from  Java EE 8 Development with Eclipse. - Third Edition

Product type Book
Published in Jun 2018
Publisher
ISBN-13 9781788833776
Pages 596 pages
Edition 3rd Edition
Languages
Toc

Table of Contents (20) Chapters close

Title Page
Copyright and Credits
Dedication
Packt Upsell
1. Introducing JEE and Eclipse 2. Creating a Simple JEE Web Application 3. Source Control Management in Eclipse 4. Creating JEE Database Applications 5. Unit Testing 6. Debugging the JEE Application 7. Creating JEE Applications with EJB 8. Creating Web Applications with Spring MVC 9. Creating Web Services 10. Asynchronous Programming with JMS 11. Java CPU Profiling and Memory Tracking 12. Microservices 13. Deploying JEE Applications in the Cloud 14. Securing JEE Applications 1. Other Books You May Enjoy Index

Java Servlet


We will now see how to implement a login application using Java Servlet. Create a new Dynamic Web Application in Eclipse as described in the previous section. We will call this LoginServletApp:

  1. Right-click on the src folder under Java Resources for the project in Project Explorer. Select the New | Servlet menu option.
  2. In the Create Servletwizard, enter package name as packt.book.jee_eclipse.book.servletand class name asLoginServlet. Then, clickFinish.

Figure 2.22: Create Servlet wizard

  1. The servlet wizard creates the class for you. Notice the @WebServlet("/LoginServlet")annotation just above the class declaration. Before JEE 5, you had to declare servlets inweb.xmlin theWEB-INFfolder. You can still do that, but you can skip this declaration if you use proper annotations. UsingWebServlet, we are telling the servlet container thatLoginServletis a servlet, and we are mapping it to the /LoginServlet URL path. Thus, we are avoiding the following two entries inweb.xmlby using this annotation...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}