JAVA Study Notes -1.Tomcat & Servlet

## web related concepts
1. The software architecture
1.C / S
2.B / S
2. resource classification
1. Static resources: after all user access, the result is the same, called static resources, static resources directly It is resolved browser.
* Such as: HTML, CSS, JavaScript
2. Dynamic resource: Once a user to access the same resources, the result may be different, known as dynamic resources, we need to be converted to a static resource, and then returned to the browser.
* As: the servlet / JSP, PHP, ASP
3. three elements of the network communication
1.IP: uniquely identifies the electronic device on the network
2. Port: application unique identifier in a computer, between 0-65536, recommended: greater than 1024 or more.
3. Transfer Protocol: provides rules for data transmission
1.tcp: security protocol, three-way handshake, slow.
2.udp: insecure protocol, fast.

## web server software:
* Server: Server software installed computer
to process the request receives the user's request, responds: * server software
* web server software:
* The web server software, you can deploy web projects, allowing users to browser to access these items,
* dynamic resource dependent web server software, the web server software, also known as web container

* Common JAVA related web server software
* weblogic: oracle companies, large javaee server, supports all javaee specifications, for a fee.
* Webshere: IBM, large javaee server, supports all javaee specification, charges.
* JBOSS: JBOSS, large javaee server, supports all javaee specification, charges.
* Tomcat: the Apache Fund, small and medium JAVAEE server, supporting a small number of JAVAEE specification (servlet / jsp), free open source.

* Javaee: the sum of the java language specification used in enterprise development, has defined 13 large specification

## Tomcat: web server software
1. Download: HTTP: //tomcat.apache.org (D: \ Study \ JAVA \ Tomcat)
2. Installation: extracting archive, but do not have Chinese or spaces in the directory
3. Uninstall: you can delete the directory
4. start:
1.bin / startup.bat, double-click operation
2. access: enter the browser: HTTP: //127.0.0.1: 8080
* problems you may encounter:
1. black flash across the window
* Cause: JAVA_HOME environment variable is not properly configured
* solution: configure JAVA_HOME environment variable
2. start error :( see in the log directory error log: the cause is by)
1. violence: netstat -ano, find PID, in the task Manager - ongoing correspondence were found killed.
2. Gentle: conf-server.xml-port, change the port (note: all ports must be changed)
5. Close
1. Normal Close:
* bin / the shutdown.bat
* In C + start window press Ctrl
2. forcibly closed :
* click start window ×
6. configuration
* deploy projects:
1. the project directly into the webapps directory.
* / Hello / resource files: access path of the project (virtual directory)
* Simple deployment: Project package packaged into war, then war package placed in the webapps directory, the war package will be decompressed automatically. (Later changed to a zip suffix)
2.conf-server.xml- tag increase <host> :( unsafe, easy to change bad Tomcat core configuration file, need to restart the service)
<Context docBase = "D: \ the Hello" path = "/ hehe" /> ( path represents the virtual directory)
3.conf-Catalina-localhost- custom xml file :( hot deployment)
* <Context docBase = "D: \ the Hello" />
* virtual directory is a custom xml the file name
* static and dynamic project project
* directory structure difference
* JAVA dynamic directory structure of the project
- the root directory of the project
- WEB-INF directory: web project's core configuration file
- classes directory: placing bytecode files
- - lib directory: placing dependent jar package

Guess you like

Origin www.cnblogs.com/jianfeihua/p/11746988.html