{"id":27140305,"url":"https://github.com/pratikkhot100/weather-web-application","last_synced_at":"2025-07-18T14:32:58.118Z","repository":{"id":286677679,"uuid":"961909874","full_name":"pratikkhot100/Weather-Web-Application","owner":"pratikkhot100","description":"Weather Application is a Java web application developed using Servlets, JSP, HTML, CSS, and JavaScript. It integrates with the OpenWeatherMap API to fetch weather data for a given city and display it to the user.","archived":false,"fork":false,"pushed_at":"2025-04-08T06:06:06.000Z","size":275,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T00:43:15.601Z","etag":null,"topics":["java","java-web-application","jsp","openweathermap-api","servlet","weather"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pratikkhot100.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-04-07T11:04:35.000Z","updated_at":"2025-04-08T06:06:10.000Z","dependencies_parsed_at":"2025-04-07T20:36:21.327Z","dependency_job_id":"882e1aba-57b6-44d6-93bd-6b8617bd3dbc","html_url":"https://github.com/pratikkhot100/Weather-Web-Application","commit_stats":null,"previous_names":["pratikkhot100/weather-web-application"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratikkhot100%2FWeather-Web-Application","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratikkhot100%2FWeather-Web-Application/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratikkhot100%2FWeather-Web-Application/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratikkhot100%2FWeather-Web-Application/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pratikkhot100","download_url":"https://codeload.github.com/pratikkhot100/Weather-Web-Application/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137998,"owners_count":21053775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["java","java-web-application","jsp","openweathermap-api","servlet","weather"],"created_at":"2025-04-08T05:51:39.284Z","updated_at":"2025-07-18T14:32:58.098Z","avatar_url":"https://github.com/pratikkhot100.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌤️ Weather_Web_Application\n\n## 📝 Description\nWeather Application is a Java web application developed using Servlets, JSP, HTML, CSS, and JavaScript. It integrates with the OpenWeatherMap API to fetch weather data for a given city and display it to the user.\n\n---\n\n## ✨ Features\nFetch weather data based on the user's input city name.\nDisplay current weather conditions including temperature, humidity, wind speed, visibility, and cloud cover, etc.\n\n---\n\n## 🛠️ Technologies Used\n- Java Servlets\n- JavaServer Pages (JSP)\n- HTML\n- CSS\n- JavaScript\n- Gson library for JSON parsing\n- OpenWeatherMap API\n\n---\n\n## ⚙️ Setup Instructions\n1. Download and install Eclipse IDE (or IntelliJ IDEA).\n2. Download and install Apache Tomcat 10.1.1.\n3. Open Eclipse IDE and configure it with Apache Tomcat:\n   - Go to `Window` -\u003e `Preferences`.\n   - Navigate to `Server` -\u003e `Runtime Environments`.\n   - Click `Add` and select `Apache Tomcat v10.1.1`.\n   - Provide the Tomcat installation directory and finish the setup.\n4. Clone the repository to your local machine using `git clone \u003crepository_url\u003e`.\n5. Import the project into Eclipse IDE:\n   - Go to `File` -\u003e `Import`.\n   - Select `Existing Projects into Workspace`.\n   - Choose the cloned project directory and import it into Eclipse.\n6. Ensure that the Gson library is included in the `src/webapp/WEB-INF/lib` directory of your project. If not, add it manually to the build path.\n7. Obtain an API key from OpenWeatherMap and replace the placeholder `myApiKey` in `MyServlet.java` with your actual API key.\n8. Run the application on your local Apache Tomcat server:\n   - Right-click on the project in Eclipse.\n   - Go to `Run As` -\u003e `Run on Server`.\n   - Select your configured Tomcat server and click `Finish`.\n9. Access the WeatherApp through your web browser using the provided URL (usually `http://localhost:8080/WeatherApp`).\n\n---\n\n## 🔌 API Integration in Servlet:\n- Created a Java servlet (MyServlet.java) to handle HTTP requests.\n- In the doPost method, fetched the city name from the form input.\n- Constructed the API URL with the city name and your API key (apiUrl) to fetch weather data.\n\n ### 🌐 HTTP Request to API:\n   -  Used HttpURLConnection to establish a connection to the API endpoint.\n   - Set the request method to GET and retrieved the API response using input streams.\n\n ### 🧠 Processing API Response:\n  - The API response was in JSON format.\n  - Used the Gson library to parse the JSON response into a JsonObject.\n  - Extracted relevant weather data like temperature, humidity, wind speed, visibility, weather condition, and cloud cover from the JSON response.\n    \n### 📤  Setting Request Attributes:\n\n  - Stored the extracted weather data, city name, date, time, and other relevant information as request attributes using HttpServletRequest.setAttribute().\n\n### 📄 Forwarding Request to JSP:\n\n  - Forwarded the request to the JSP page (index.jsp) for rendering using RequestDispatcher.forward().\n\n### 🖥️ Displaying Data in JSP:\n\n  - In our JSP page (index.jsp), we used HTML and embedded Java code (EL expressions) to display the weather data.\n  - Accessed the data from request attributes using ${attributeName} syntax.\n\n---\n\n## 🖼️ Some Screenshots for the project:\n\n ![Screenshot 2025-04-08 005632](https://github.com/user-attachments/assets/da5611ff-8a59-4855-b24f-d7ce34c3b146)\n\n![Screenshot 2025-04-08 005650](https://github.com/user-attachments/assets/95a9d40b-5550-44ee-a9d0-2e857c3ccf6c)\n\n![Screenshot 2025-04-08 005809](https://github.com/user-attachments/assets/4a924359-9aaa-4377-856d-b5222f3f1359)\n\n---\n\n ## 📞 Contact Information\n\n  🐙 GitHub: https://github.com/pratikkhot100\n\n  💼 LinkedIn: https://www.linkedin.com/in/pratikkhot01\n\n  📧 Email: pratikkhot1207@gmail.com\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpratikkhot100%2Fweather-web-application","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpratikkhot100%2Fweather-web-application","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpratikkhot100%2Fweather-web-application/lists"}