Servlet
Servlet technology mainly used for web application creation at server side and dynamic web pages. Before Servlets, CGI (Common Gateway Interface) scripting language was used as a server-side programming language. But, there were many disadvantages of this technology.
Disadvantages of CGI:
Follow the below instructions to create the Dynamic web project in eclipse.
File ---> new ---> Dynamic web project
Click on 'Next' to move forward in web project creation.
click on 'Finish' button to create Dynamic web project. Your New project has been listed in project list.
We have to add servlet-api.jar to load all the servlet class files into newly created web application. To download "servlet-spi.jar" and add the JAR file into Dynamic web project class path.
If you're using maven project, just you can add dependency in your pom.xml file as followed below,
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api-2.5</artifactId>
<version>6.1H.14</version>
</dependency>
Disadvantages of CGI:
- If number of clients will send requests, it takes more time for sending response.
- For each request, it starts a process and web server is limited to start process.
- It uses platform dependent language. e.g: C,C++,etc.
- Better performance it creates new thread for each request.
- Portability because it uses java language.
- Robust Servlets are managed by JVM. So, no need to worry about memory leak, garbage collection and etc.
- Secure because it uses java language.
Follow the below instructions to create the Dynamic web project in eclipse.
File ---> new ---> Dynamic web project
- Please fill the Project Name field as shown in below screenshot. You can define your own Project Name.
- Choose Target Runtime as per your convenience, if any web servers has been installed.
- Dynamic Web Module Version will be identified based on the configured Target Runtime server.
We have to add servlet-api.jar to load all the servlet class files into newly created web application. To download "servlet-spi.jar" and add the JAR file into Dynamic web project class path.
If you're using maven project, just you can add dependency in your pom.xml file as followed below,
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api-2.5</artifactId>
<version>6.1H.14</version>
</dependency>
Comments
Post a Comment