Javaweb Study Summary (i) Introduction to Javaweb development

Source: Internet
Author: User

Static and Dynamic Web pages

Static Web pages: Web pages that are not interpreted by the server to be executed on the server.

Dynamic Web page: A Web page that is interpreted by the server on the server for execution.

Whether it is a static or Dynamic Web page, the client sees the page is composed of HTML, so javaweb development needs to understand HTML.

Servlet and Servlet containers

Servlet: is a collection of Java classes that implement a particular interface.

The servlet container is where the Jsp/servlet code runs and is where the Jsp/servlet is managed.

The servlet container is actually a server software, such as Tomcat.

HTTP protocol

The browser requests the Server Web page procedure, follows the HTTP protocol, so the request server's webpage may be called sends the HTTP request to the server, and the server returns the Web page to the browser can be called returns the HTTP response to the browser.

The HTTP protocol is to add some control information in front of the information to be sent, to form an HTTP request or an HTTP response, so that the server knows what information the browser has requested before the browser knows what information the server sends.

Specifically what information to add, please poke this.

The process of browser HTTP requests

1. Enter the URL in the browser address bar

2. The URL is parsed into an IP address by DNS, and DNS returns the IP address to the browser. (If the browser's cache has the corresponding IP for that URL, it does not send the request like DNS.)

3. Send HTTP to the server that corresponds to the IP address.

4. Server software (such as Tomcat) in the server obtains the requested information.

5. If the requested static Web page is returned directly to the browser, if the requested Dynamic Web page is executed in the servlet container, the page result is generated and then sent to the browser.

6. The browser receives an HTTP response.

Installing Tomcat

Download the. zip file on the 1.MAC computer and unzip it into a folder, then find a place to place it, and I'll put it in the/library directory.

2. Go to the Bin directory, execute the sudo chmod 755 *.sh, and set all the server-related scripts in the bin directory to be operational, often startup.sh and shutdown.sh.

3. Set the environment variables for the Java Bin directory, because Tomcat is the servlet container, you must run Java commands to compile the code, and set the environment variables of the Tomcat Bin directory so that you can use script commands anywhere in the shell. Instead of switching to Tomcat's Bin directory, you can use the command.

4. In the browser input http://localhost:8080, if the normal access, indicating that the installation was successful.

Tomcat's directory structure

Bin: The various script files that hold tomcat, start the server startup.sh, shut down the server shutdown.sh.
Conf: The configuration file for tomcat is stored, and if the server is running with a modified configuration file, the server must be restarted before the configuration file can be read back.
Logs: The log file is stored, and when a bug occurs, look at the log file.
Temp: Stores temporary files that are generated by the Tomcat runtime.
The directory where the Webapps:web application resides, and the written application is placed here to access it.
Work:tomcat's working directory.

Web APP directory structure

The servlet specification defines the directory hierarchy of the Web application.

The root directory of the Webroot:web app, which has a web-inf directory under it, as well as HTML pages and JSP pages. When you deploy a web app, you copy the folder to the Tomcat WebApps folder. Web-inf: There is Web. XML in this directory, which is the configuration file for the application, as well as the Classes folder and the Lib folder. Classes: After compiling the Java code into a class file, put it in this directory. LIB: Placing a jar package

» This article links:Http://alphaway.org/post-283.html
» Subscribe to this site:Http://www.alphaway.org» reprint Please indicate source:Alphaway Blog» Javaweb Learning Summary (i) Javaweb Development introduction0 0

Javaweb Study Summary (i) Introduction to Javaweb development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.