{"id":24124804,"url":"https://github.com/shahkv95/javaservlet","last_synced_at":"2026-06-12T15:31:18.034Z","repository":{"id":133565389,"uuid":"306491009","full_name":"shahkv95/JavaServlet","owner":"shahkv95","description":"The servlets provide an object-based, independent, web-based application building platform, without the limitations of CGI programs. Servlets have access to the entire Java APIs family, including the JDBC API to access business information. This project is mainly focused to understand how to use Java resources to improve our web-based applications in simple and easy steps.","archived":false,"fork":false,"pushed_at":"2021-09-10T21:33:00.000Z","size":3940,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-01T00:09:36.341Z","etag":null,"topics":["dynamic-web-app","eclipse","java","jdk","oracle-jdk8","servlet","tomcat-server","tomcat9"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shahkv95.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-23T00:35:31.000Z","updated_at":"2023-03-04T07:45:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"89cdf759-0516-402a-89b3-b17437d69ed4","html_url":"https://github.com/shahkv95/JavaServlet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shahkv95/JavaServlet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahkv95%2FJavaServlet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahkv95%2FJavaServlet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahkv95%2FJavaServlet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahkv95%2FJavaServlet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shahkv95","download_url":"https://codeload.github.com/shahkv95/JavaServlet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahkv95%2FJavaServlet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34251774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dynamic-web-app","eclipse","java","jdk","oracle-jdk8","servlet","tomcat-server","tomcat9"],"created_at":"2025-01-11T14:36:23.565Z","updated_at":"2026-06-12T15:31:18.008Z","avatar_url":"https://github.com/shahkv95.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003ch1 align=\"center\"\u003eCreating Java Servlet in Eclipse\u003c/h1\u003e\n\n\n\u003cbr /\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.eclipse.org/\"\u003e\n    \u003cimg src=\"images/eclipse.png\"\u003e\n  \u003c/a\u003e\n\n\n  \u003cp align=\"center\"\u003e\n    A program to understand how Java Servlet works! \n    \u003cbr /\u003e\n    \u003ca href=\"https://tomcat.apache.org/tomcat-5.5-doc/servletapi/\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"#\"\u003eView Demo\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/shahkv95/JavaServlet/issues\"\u003eReport Bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/shahkv95/JavaServlet/issues\"\u003eRequest Feature\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n[![Tomcat][dependencies_ts]][dependencies_ts-url]\n[![Oracle JDK][dependencies_jdk]][dependencies_jdk-url]\n[![Eclipse][dependencies_ecl]][dependencies_ecl-url]\n[![MIT License][license-shield]][license-url]\n[![LinkedIn][linkedin-shield]][linkedin-url]\n\n\u003c!-- TABLE OF CONTENTS --\u003e\n## Table of Contents\n\n* [About the Project](#about-the-project)\n* [Built With](#built-with)\n* [Getting Started](#getting-started)\n* [Creating the Project from scratch](#creating-the-project-from-scratch)\n* [Directly running this project](#directly-running-this-project)\n* [Roadmap](#roadmap)\n* [Contributing](#contributing)\n* [License](#license)\n* [Contact](#contact)\n\n\n\n\n\u003c!-- ABOUT THE PROJECT --\u003e\n## About The Project\n\n\u003cimg src=\"images/click.png\" \u003e\n\nThe servlets provide an object-based, independent, web-based application building platform, without the limitations of CGI programs. Servlets have access to the entire Java APIs family, including the JDBC API to access business information. This project is mainly focused to understand how to use Java resources to improve our web-based applications in simple and easy steps.\n\nApplications of this project with certain extensions:\n\n* Read clear data sent to clients (browsers). This includes data that can come from HTTP client system or an applet or the HTML form on a Web page.\n\n* Read the requested HTTP request data sent to clients (browsers). This includes cookies, media types and so on.\n\n* Process data and create results. This process may require database communication, making an RMI, installing a Web service, or entering a direct response to a computer.\n\n* Send explicit data (e.g., documents) to customers (browsers). This text can be exported in a variety of ways, including text (HTML or XML), binary (GIF images), Excel, etc.\n\n* Send anonymous HTTP response to customers (browsers). This includes telling browsers or other clients what type of document is being returned (e.g., HTML), setting cookies and cache restrictions, and other such functions.\n\n\n### Built With\nThis project was built using the following tools/frameworks:\n\n* [Apache Tomcat](http://tomcat.apache.org/)\n* [Eclipse IDE](https://www.eclipse.org/downloads/packages/release/helios/sr1/eclipse-ide-java-developers)\n* [Oracle Java Development Kit](https://www.oracle.com/in/java/technologies/javase/javase-jdk8-downloads.html)\n\n\n### Getting Started\n\nTo run the project successfully, you need to download and install the three tools/frameworks mentioned before. For ease of access, follow the below steps to complete the process easily.\n* Apache Tomcat\n\n\u003e 1. Go to [Apache Tomcat](http://tomcat.apache.org/)\n\u003e 2. Download the latest stable version of Apache Tomcat Server. For this project, I have used [Apache Tomcat v9.0 Download](https://tomcat.apache.org/download-90.cgi)\n\u003e 3. When you are on this page - [Apache Tomcat v9.0 Download](https://tomcat.apache.org/download-90.cgi), download \u003cb\u003eapache-tomcat-9.0.39-windows-x64\u003c/b\u003e by clicking on the option \u003c/b\u003e64-bit Windows zip (pgp, sha512)\u003c/b\u003e\n\u003e 4. Extract the files/ folders present in_ the downloaded files\n\u003e 5. Open the extracted folder(\u003cb\u003eapache-tomcat-9.0.39\u003c/b\u003e). Go to bin and install the \u003cb\u003etomcat9 application\u003c/b\u003e\n\n\n* Eclipse IDE\n\n\u003e 1. Go to [Eclipse IDE Download](https://www.eclipse.org/downloads/packages/release/helios/sr1/eclipse-ide-java-developers)\n\u003e 2. Download the latest stable version of Eclipse IDE. For this project, I have used [Eclipse Installer 2020-09 R](https://www.eclipse.org/downloads/download.php?file=/oomph/epp/2020-09/R/eclipse-inst-jre-win64.exe)\n\u003e 3. On downloading the installer, extract if_ a zip file is downloaded\n\u003e 4. Double click on the installer and install the \u003cb\u003eEclipse IDE for Enterprise Java Developers\u003c/b\u003e\n\u003e 5. Accept the required permission(after you agree to them by going through the terms and conditions) and finish the process to successfully install the IDE\n\n\n* Oracle Java Development Kit\n\n\u003e 1. Go to [Oracle JDK 8 Download](https://www.oracle.com/in/java/technologies/javase/javase-jdk8-downloads.html)\n\u003e 2. Download the latest stable version of Oracle JDK. For this project, I have used Oracle JDK 8(\u003cb\u003ejdk-8u271-windows-x64.exe\u003c/b\u003e). Before downloading you have to first create your account on the site and then click on the favorable installer\n\u003e 3. On downloading the installer, extract if_ a zip file is downloaded\n\u003e 4. Double click on the installer and install the \u003cb\u003ejdk-8u261-windows-x64\u003c/b\u003e jdk8\n\u003e 5. Accept the required permission(after you agree to them by going through the terms and conditions) and finish the process to successfully install the IDE\n\n\n\n### Creating the Project from scratch\n\n#### Brief introduction of the process\n* Create a Dynamic web project\n* Create a servlet\n* Add servlet-api.jar file\n* Write the servlet code\n* Configure the server\n* Run the servlet\n\n#### Detailed steps to follow\n1. Creating a Dynamic web project\n```md\n1.1 Open Eclipse\n1.2 File --\u003e New --\u003e Dynamic Web Project\n1.3 Enter project_name --\u003e Chose target runtime(Apache Tomcat v9.0 or the version you installed) --\u003e Next --\u003e Next \n1.4 Check the checkbox of Generate web.xml deployment descriptor --\u003e Finish\n1.5 You will see the message - \"Installing Dynamic Web Module Facet...\" \n1.6 On completion you can see your project folder created under the \"Project Explorer\" view frame.\n```\n![](https://github.com/shahkv95/JavaServlet/blob/main/images/DynamicWebPage.gif)\n\n\n\n2. Creating a servlet in Eclipse\n```md\n2.1 Right click on the project name\n2.2 Click on New --\u003e Servlet\n2.3 Enter the class name(say \"MyServlet\") --\u003e Next --\u003e Next\n2.4 Uncheck the methods that are not required and check the method names that you require in your project/java file --\u003e Finish\n2.5 \"MyServlet.java\" file will be created with the basic template. Now you can write your own code here. \n```\n![](https://github.com/shahkv95/JavaServlet/blob/main/images/CreatingServlet.gif)\n\n3. Adding servlet-api.jar file\n```md\n3.1 Right click on the project name\n3.2 Click on Build Path --\u003e Configure build path\n3.3 Under the \u003cb\u003eLibraries\u003c/b\u003e tab, click on \u003cb\u003eAdd External JARs\u003c/b\u003e present in the right columnar frame\n3.4 Browse and open the Tomcat folder that you downloaded --\u003e lib folder --\u003e select servlet-api.jar file --\u003e Open --\u003e Apply and Close\n3.5 The required servlet api file would be added \n```\n![](https://github.com/shahkv95/JavaServlet/blob/main/images/ServletApi.gif)\n\n\n4. Writing the servlet code in Eclipse\n```md\n4.1 Your program will still run with this basic template \n4.2 You can write your own code in the java file\n4.3 For simplicity you can consider this code for ease of understanding\n```\n```java\n \n\n\n\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport javax.servlet.ServletException;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n/**\n * Servlet implementation class MyServlet\n */\n@WebServlet(\"/MyServlet\")\npublic class MyServlet extends HttpServlet {\n\tprivate static final long serialVersionUID = 1L;\n       \n    /**\n     * @see HttpServlet#HttpServlet()\n     */\n    public MyServlet() {\n        super();\n        // TODO Auto-generated constructor stub\n    }\n\n\t/**\n\t * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)\n\t */\n\tprotected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\t\t// TODO Auto-generated method stub\n\t\tresponse.getWriter().append(\"Served at: \").append(request.getContextPath());\n\t\tresponse.setContentType(\"text/html\");\n\t\tPrintWriter output=response.getWriter();\n\t\t\n\t\toutput.print(\"\u003chtml\u003e\u003cbody\u003e\");\n\t\toutput.print(\"\u003ch3\u003eHi! This is Kush Shah.\u003c/h3\u003e\");\n\t\toutput.print(\"\u003ch3\u003eAnd this output verifies that we have successfully deployed the servlet on tomcat v9.0 server.\u003c/h3\u003e\");\n\t\toutput.print(\"\u003c/body\u003e\u003c/html\u003e\");\n\t}\n\n\t/**\n\t * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)\n\t */\n\tprotected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\t\t// TODO Auto-generated method stub\n\t\tdoGet(request, response);\n\t}\n\n}\n\n\n\n```\n```md\n4.4 Ctrl+S to save the code\n```\n\n5. Configuring the server\n```md\n5.1 Right click in the blank area under the server tab in the pane present below the code area.\n5.2 Click on New --\u003e Server\n5.3 Select the server you installed(I chose Tomcat v9.0 Server) under the server type --\u003e Next\n5.4 Click on Add All --\u003e Finish\n5.5 The required server is configured and ready to host a program \n```\n![](https://github.com/shahkv95/JavaServlet/blob/main/images/ConfigureServlet.gif)\n\n\n6. Running the servlet\n```md\n6.1 Right click on the project name\n6.2 Select Run As --\u003e 1 Run on Server\n6.3 Select \u003cb\u003eChoose an existing server\u003c/b\u003e --\u003e select the Tomcat server under the localhost folder --\u003e Next\n6.4 Click on Add All --\u003e Finish\n6.5 You will encounter \u003cb\u003eHTTP Status 404 – Not Found\u003c/b\u003e. Dont worry. It is because the local address is just accessing the folder and not the java file.\n6.6 To solve this issue, typw the name of the file after the '/'. So at the end it will look like --\u003e \u003cb\u003ehttp://localhost:8080/understanding/file_name\u003c/b\u003e\n6.7 Press Enter and you will be able to see the desired output...!\n```\n![](https://github.com/shahkv95/JavaServlet/blob/main/images/RunningOnServer.gif)\n\n\n### Directly running this project\n\n##### It is assumed that before running the project you have the already created the required local environment.\n\u003e 1. Download the zip file of this project from the \u003cb\u003eCode\u003c/b\u003e button of the project\n\u003e 2. Extract the files\n\u003e 3. Open the Eclipse IDE\n\u003e 4. Go to File --\u003e Import \n\u003e 5. Open the dropdown of General folder --\u003e Existing Projects into Workspace --\u003e Next \n\u003e 6. Browse and select the downloaded and extracted folder of this project --\u003e Check the option \"Copy projects into workspace\" --\u003e Finish\n\u003e 7. Your complete project would be ready to be deployed on the server.\n\u003e 8. Right click on the project and follow the above step #6\n\n### Yes We Did It\n![](https://media.giphy.com/media/lMVNl6XxTvXgs/giphy.gif)\n\n\n\n\u003c!-- ROADMAP --\u003e\n## Roadmap\n\nSee the [open issues](https://github.com/shahkv95/JavaServlet/issues) for a list of proposed features (and known issues).\n\n\n\n\u003c!-- CONTRIBUTING --\u003e\n## Contributing\n\nIf you like the project then kindly give a star to the repo. Any contributions you make are **greatly appreciated**.\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n\n\n\u003c!-- LICENSE --\u003e\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n\n\n\n\u003c!-- CONTACT --\u003e\n## Contact\n\n[Kush Shah](https://www.linkedin.com/in/kush-shah-5a771b169/)\n\nProject Link: [Java Servlet](https://github.com/shahkv95/JavaServlet)\n\n\n\n\n[dependencies_ts]: https://img.shields.io/badge/TomcatServer-v9.0-blue\n[dependencies_ts-url]: https://tomcat.apache.org/download-90.cgi\n\n[dependencies_jdk]: https://img.shields.io/badge/Oracle%20JDK-SE%208-orange\n[dependencies_jdk-url]: https://www.oracle.com/in/java/technologies/javase/javase-jdk8-downloads.html\n\n[dependencies_ecl]: https://img.shields.io/badge/Eclipse-2020--09-brightgreen\n[dependencies_ecl-url]: https://www.eclipse.org/downloads/packages/release/helios/sr1/eclipse-ide-java-developers\n\n[license-shield]: https://img.shields.io/badge/license-MIT-ff69b4\n[license-url]: https://raw.githubusercontent.com/shahkv95/JavaServlet/main/LICENSE\n\n[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=flat-square\u0026logo=linkedin\u0026colorB=555\n[linkedin-url]: https://www.linkedin.com/in/kush-shah-5a771b169/\n[product-screenshot]: images/click.png\n\n### Time To Celebrate It\n![](https://media.giphy.com/media/yoJC2GnSClbPOkV0eA/giphy.gif)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshahkv95%2Fjavaservlet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshahkv95%2Fjavaservlet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshahkv95%2Fjavaservlet/lists"}