This tutorial will teach you servlets in Java.
In this tutorial you'll learn:
In this tutorial you'll learn:
- Desktop and web applications
- Installing and configuring Tomcat
- Http protocol and port numbers
- Servlet basics
- Generic and Http Servlets, form submissions
- Annotations in servlets
- Servlet communication
- Cookies
- Session Tracking
1. Desktop and web applications
You'll need to learn what are web apps before you start developing them.- Desktop and web applications (including web design vs web development)
2. Installing and configuring Tomcat
To work with servlets, you need a web server. We will use Tomcat here. Download Tomcat 7
- How to install tomcat in Windows? (includes setting classpath)
3. HTTP Protocol and port numbers
You need to learn what is HTTP protocol, static and dynamic pages before you develop any web application.- Brief view of HTTP protocol (including static vs dynamic pages, HTTPS, hyper-text)
- Understanding port numbers (2-minute guide)
4. Servlet basics
You'll need to learn the basics of Java servlets that help you ace the web development with Java.- Basics of Java servlets (with disadvantages of CGI)
5. Generic and Http Servlets
Generic servlets are protocol-independent, it isn't just for http protocol.
Http servlets are strictly for http protocol.
There are two ways of sending data (aka making request or user input) from client to server. They are GET and POST.GET transfers data via the address bar as query string. For example,
http://google.com/search?q=amazon
POST transfers data in background and hence not visible in the address bar. This is used for sending usernames and passwords as they must not be visible in the address bar.
6. Annotations in servlets
We can use annotations in servlets. Annotation is data about a class or a member variable or a method that will be useful at run time.
7. Servlet communication
Servlets need to communicate with each other to transfer data from one servlet to another.
- Servlet to servlet communication (passing request object)
8. Cookies
Cookies are key-value pairs that are stored in the web browser. As HTTP is a stateless protocol, there must be some way for the web application to keep track of the previous requests by the user. For example, in amazon.com while shopping, our items are stored in the cart though we move to other pages, we will be displayed the previous items that we have added. This is because, our previous data is stored. Where? In our browser only!
9. Session Tracking
Session tracking is an alternative to cookies. Cookies are stored in client browser, sessions are stored in server. What if cookies are disabled in browser? What if they are manually deleted? For all this, session tracking is the ultimate solution.
No comments:
Post a Comment