Watch “Servlet Part-12 (Servlet Collaboration)” on YouTube

Some times servlets have to cooperate, i.e. usually by sharing information.
This communication can be called as Sort Servlet collaboration.
The servlet, which are collaborating, can pass the shared information directly from one servlet to another. Request Dispatcher defines an object that receives requests from the client and sends them to any resource (such as a servlet, HTML file, or JSP file) on the server. The servlet container creates the RequestDispatcher object, which is used as a wrapper around a server resource located at a particular path or given by a particular name.

OS : Windows 10
Jdk : Version 8
IDE : Eclipse Mars
Server : Apache Tomcat 7

follow me @
https://raviroza.wordpress.com/
https://twitter.com/raviozaIT
https://www.facebook.com/ravi.oza.it

Subscribe my channel to get latest video notification https://www.youtube.com/user/ravioza101

Watch “Servlet Part-11 (Redirection in Servlet)” on YouTube

Servlet Redirection :

  • Local resource like servlet, jsp or html page etc.
  • Resource outside of our domain/application
  • Example of searching Google from out application

Servlet Redirection can be used to transfer/forward control to Local resource like servlet, jsp or html page etc., It can also used to transfer/forward the Resource outside of our domain/application. Here there is an example to transfer request from one servlet to anohter servlet when client request the first servlet. This example also demonstrate how it refers the another html page for redirection. And finally this example also demonstrate a trick to search Google directly from our application.

OS : Windows 10
Jdk : Version 8
IDE : Eclipse Mars
Server : Apache Tomcat 7

follow me @
https://raviroza.wordpress.com/
https://twitter.com/raviozaIT
https://www.facebook.com/ravi.oza.it

Subscribe my channel to get latest video notification https://www.youtube.com/user/ravioza101

Watch “Servlet Part-10 (Demo of Request Object Methods)” on YouTube

Demonstration of HttpRequest object methods, such as getRemoteAddr(), getRemoteHost(), getQueryString(), setAttribute(), getAttribute(), getAttributeNames(). To check all these method its is suggestible to create html/jsp page that will call/execute/request the servlet which will be using above methods.

OS : Windows 10
Jdk : Version 8
IDE : Eclipse Mars
Server : Apache Tomcat 7

follow me @
https://raviroza.wordpress.com/
https://twitter.com/raviozaIT
https://www.facebook.com/ravi.oza.it

Subscribe my channel to get latest video notification https://www.youtube.com/user/ravioza101

Watch “Servlet Part-9 (Enumeration to Read Headers and Parameters)” on YouTube

A request object of servlet consist the client information , such as client header information and client input parameters.
Here, Enumeration is used to read the values of client headers (list of headers) and to read the values of parameters (list of input parameters).

OS : Windows 10
Jdk : Version 8
IDE : Eclipse Mars
Server : Apache Tomcat 7

follow me @
https://raviroza.wordpress.com/
https://twitter.com/raviozaIT
https://www.facebook.com/ravi.oza.it

Subscribe my channel to get latest video notification https://www.youtube.com/user/ravioza101

Watch “Servlet Part-8 (Servlet Context and Servlet Config parameter)” on YouTube

Servlet Context parameters are application wide parameter (such as global variables) accessible through out web application, any servlet or Jsp page can access these parameters, and there is only one copy of such parameters per web app.

These parameters are to be configured in web.xml file in java web application.

Servlet config parameters are specific to the servlet for which is declared, it is local for that servlet. These parameters are private to each servlet. These parameters are also configured in web.xml (inside servlet tag).

OS : Windows 10
Jdk : Version 8
IDE : Eclipse Mars
Server : Apache Tomcat 7

follow me @
https://raviroza.wordpress.com/
https://twitter.com/raviozaIT
https://www.facebook.com/ravi.oza.it

Subscribe my channel to get latest video notification https://www.youtube.com/user/ravioza101

Servlet Part-7 (Servlet Mapping with Deployment Descriptor/web.xml file)

Deployment descriptor file which is also known as web.xml file, is used to configure the web app as well as servlet.

It is most important while the web app is to be deployed on the server, for example the database connection is going to differ while you deploy the app on server, so its preferable to define such settings in web.xml file because its a tag file which can be easily editable in any editor.

If we define the such settings in java file they need to be edited and re-compile on server, which is not feasible.

OS : Windows 10
Jdk : Version 8
IDE : Eclipse Mars
Server : Apache Tomcat 7

follow me @
https://raviroza.wordpress.com/
https://twitter.com/raviozaIT
https://www.facebook.com/ravi.oza.it

Subscribe my channel to get latest video notification https://www.youtube.com/user/ravioza101

Watch “Servlet Part-6 (Arithmetic Operations Example using Servlet)” on YouTube

Arithmetic Operations of two numbers using Servlet.

  • index.html (client side : user interface to accept the input from user)
  • airth.java (server side : servlet to process request made by user to perform arithmetic operation on two number)

OS : Windows 10
Jdk : Version 8
IDE : Eclipse Mars
Server : Apache Tomcat 7

follow me @
https://raviroza.wordpress.com/
https://twitter.com/raviozaIT
https://www.facebook.com/ravi.oza.it

Subscribe my channel to get latest video notification https://www.youtube.com/user/ravioza101

Watch “Servlet Part-4 (Servlet Life Cycle Example)” on YouTube

Servlet Interface provides general activities for servlet.

It resides in javax.servlet.Servlet, when implementing Servlet following five method must be implemented (init, service, destroy, getServletConfig & getServletInfo).

OS : Windows 10
Jdk : Version 8
IDE : Eclipse Mars
Server : Apache Tomcat 7

follow me @
https://raviroza.wordpress.com/
https://twitter.com/raviozaIT
https://www.facebook.com/ravi.oza.it

Subscribe my channel to get latest video notification https://www.youtube.com/user/ravioza101

Watch “Servlet Part-3 (Generic Servlet Example)” on YouTube

Practical Implementation of Servlet using GenericServlet Class

Step to Create Servlet using GenericServlet Class

  1. Apache Tomcat configuration in Eclipse for web projects
  2. Creating Dynamic web project
  3. Add java class that extends the GenericServlet class (in new class wizard)

OS : Windows 10
Jdk : Version 8
IDE : Eclipse Mars
Server : Apache Tomcat 7

follow me @
https://raviroza.wordpress.com/
https://twitter.com/raviozaIT
https://www.facebook.com/ravi.oza.it

Subscribe my channel to get latest video notification https://www.youtube.com/user/ravioza101