I want to create a java web application for improve my knowledge. Because our company projects are based on this.So I should to understand about web application widely. So I create web application.All steps are mention below one by one.
Web Applications are used to create dynamic websites. Java provides support for web application through Servlets and JSPs. We can create a website with static HTML pages but when we want information to be dynamic, we need web application
Web Server is a software that can process the client request and send the response back to the client. For example, Apache is one of the most widely used web server. Web Server runs on some physical machine and listens to client request on specific port.A web client is a software that helps in communicating with the server. Some of the most widely used web clients are Firefox, Google Chrome, Safari etc. When we request something from server (through URL), web client takes care of creating a request and sending it to server and then parsing the server response and present it to the user.Web Server and Web Client are two separate softwares, so there should be some common language for communication. HTML is the common language between server and client and stands for Hyper TextMarkup
Language.
Understanding URL
URL is acronym of Universal Resource Locator and it’s used to locate the server and resource. Every resource on the web has it’s own unique address. Let’s see parts of URL with an example. http://localhost:8080/FirstServletProject/jsps/hello.jsp http:// – This is the first part of URL and provides the communication protocol to be used in server-client communication.
localhost – The unique address of the server, most of the times it’s the hostname of the server that maps to unique IP address. Sometimes multiple hostnames point to same IP addresses and web server virtual host takes care of sending request to the particular server instance.
8080 – This is the port on which server is listening, it’s optional and if we don’t provide it in URL then request goes to the default port of the protocol. Port numbers 0 to 1023 are reserved ports for well known services, for example 80 for HTTP, 443 for HTTPS, 21 for FTP etc.
Why we need Servlet and JSPs?
Web servers are good for static contents HTML pages but they don’t know how to generate dynamic content or how to save data into databases, so we need another tool that we can use to generate dynamic content. There are several programming languages for dynamic content like PHP, Python, Ruby on Rails, Java Servlets and JSPs .Java Servlet and JSPs are server side technologies to extend the capability of web servers by providing support for dynamic response and data persistence.
Web Application Directory Structure
Java Web Applications are packaged as Web Archive (WAR) and it has a defined structure. You can export above dynamic web project as WAR file and unzip it to check the hierarchy. It will be something like below image.

No comments:
Post a Comment