Familiar javaEE mainstream framework Spring boot, Spring Cloud, Mybatis, understand Servlet, JDBC

What is Tomcat

Apache server software to provide small to support servet and jsp specifications 
lib package: storage jar package 
WabApp: publishing directory project 
work: jsp compiled. class directory 
LOgs: store log files

HTTP protocol

Request line, request headers and the request body 
request line: 
        request method of requesting URL HTTP version of the 
request header: 
        the Host:             
        the User-- Agent:   
        the Accept: 
        the Accept-Language 
        the Accept-Encoding: 
        the Referer: 
        onnection: 
        cookies:        
request body: 
        GET did not request, i.e. behind URL, post body there is a request, the address bar is not displayed in                   

response to the line, in response to the first response member, and 
 a response line: 
 2 the HTTP protocol status code 
 3 in response header: 
 . 4 the Accept-Ranges: bytes 
 . 5 the Cache-Control: max- = 0 Age 
 . 6 Connection: Keep-Alive 
 . 7 the Content-the Length: 114 
 . 8 the Content-the Type: text / HTML 
 . 9 a Date: the Sun, 01 On Sep 2019 14:09:54 GMT 
10 an Etag: "5d2c473c-72" 
. 11 the Expires: the Sun, 01 On Sep 2019 14:09:54 GMT 
12 is Last-Modified: Mon, 15 Jul-2019 09:28: GMT 28 
13 is Server: Nginx 
14 request body: 
15 images, text, HTML ......       
    normal redirect 404 302 500 internal path 200 not found error

 Understanding of the Servlet

refers servlet server + applet server program 
for handling client requests and respond to the request 

using the Tomcat servlet need to import and servlet.jar api.jar 

obtain parameters: String unsername = request.getParameter ( "username "); 
the memory is a single example of the 
life cycle: 
creation: when first accessed, call the init () method 
work: call doGET and doPOST method 
destruction: call Destory method

 JDBC

c3p0-config.xml

public class ConSql {
    public void test1() throws SQLException {
        QueryRunner queryRunner = new QueryRunner(new ComboPooledDataSource());
        String sql = "insert into student values(?,?,?)";
        Object[] obj = {14,"df",32};
        queryRunner.update(sql,obj);
    }
}

<dependency>
            <groupId>com.mchange</groupId>
            <artifactId>c3p0</artifactId>
            <version>0.9.5.2</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.6</version>
        </dependency>
        <dependency>
            <groupId>commons-dbutils</groupId>
            <artifactId>commons-dbutils</artifactId>
            <version>1.6</version>
        </dependency>

Guess you like

Origin www.cnblogs.com/cheng5350/p/11963889.html