JavaWeb主要指使用Java语言进行动态Web资源开发技术的统称,是解决相关Web互联网领域的技术总和
请求行 请求类型 请求的路径 协议的版本(1.1) 请求头 主机 请求长度 请求的浏览器相关信息 空白行 (一个空行) 请求体 也叫请求数据,可以添加任意的其他数据
POST /task01_demo01/demo1.html HTTP/1.1 Host: localhost:8088 Content-Length: 21 Cache-Control: max-age=0 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) name=scott&pwd=123456
响应行 协议的版本(1.0 1.1) 状态码 (200 成功 404 路径错误 500 服务错误) 状态信息 响应头 说明客户端要使用的一些附加信息,格式(key:value) 空白行 (一个空行) 响应体 服务器返回给客户端的文本信息
Tomcat官网https://tomcat.apache.org/download-90.cgi
Tomcat 百度云:https://pan.baidu.com/s/1iEEptTiPXPLls3wBpSUg1g提取码:gv2h
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-d2TVQrAT-1626572780953)(http://m.qpic.cn/psc?/V54CA0n72MKGGb0pfLXF4OTqRY0DGvXI/ruAMsa53pVQWN7FLK88i5ppGCramJEjTYRYKirLRt8gxxq1gURFk7A6CDikIzseE5MaO4BFiZzuYECY10u2C1PTrUQ4uLxjCptvUHcM68Wo!/b&bo=gAcGBIAHBgQDCSw!&rf=viewer_4)]
解压到想安装的目录
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-iWZIiwce-1626572780956)(http://m.qpic.cn/psc?/V54CA0n72MKGGb0pfLXF4OTqRY0DGvXI/ruAMsa53pVQWN7FLK88i5ozXp5J8ODXgQOiGzKIjkQPecqPKvaI6qInI3iYhMIBZ9qht4HOl3Z8zcmV35lMeyOMDQ6oqOCfGpLTcTYtiKjw!/b&bo=gAc4BIAHOAQDCSw!&rf=viewer_4)]
添加环境变量
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-qZ8Imomj-1626572780959)(http://m.qpic.cn/psc?/V54CA0n72MKGGb0pfLXF4OTqRY0DGvXI/ruAMsa53pVQWN7FLK88i5ppGCramJEjTYRYKirLRt8goZ192BvnYdHzp.XolRm4PYQlf2k7.kHf4pbOlvVykP1HRwNtO1J89K5.cq1DRoCc!/b&bo=gAc4BIAHOAQDCSw!&rf=viewer_4)]
添加CATALINA_BASE变量
CATALINA_BASE D:\apache-tomcat-9.0.31
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Yv6fFBSx-1626572780962)(http://m.qpic.cn/psc?/V54CA0n72MKGGb0pfLXF4OTqRY0DGvXI/ruAMsa53pVQWN7FLK88i5ppGCramJEjTYRYKirLRt8iT8dYYCyhJwe635S2*1zXLeX0hbKl4QRilbznXdUhFg29MLEBfuP4y0bKuHf7JBrM!/b&bo=gAc4BIAHOAQDCSw!&rf=viewer_4)]
添加CATALINA_HOME变量
CATALINA_HOME D:\apache-tomcat-9.0.31
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-hZ1YDIh3-1626572780964)(http://m.qpic.cn/psc?/V54CA0n72MKGGb0pfLXF4OTqRY0DGvXI/45NBuzDIW489QBoVep5mcQmSby57ateXuhqj1ybHQX1ZEXY.EFO3zx1Z6NmD2tLox408Qrk.R9Qx*WdjhI84aohguKkDcSVuN6XlKyDH154!/b&bo=gAc4BIAHOAQDWXw!&rf=viewer_4)]
添加到PATH变量
%CATALINA_HOME%\bin;%CATALINA_HOME%\lib
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-xflKGCa6-1626572780965)(http://m.qpic.cn/psc?/V54CA0n72MKGGb0pfLXF4OTqRY0DGvXI/ruAMsa53pVQWN7FLK88i5ozXp5J8ODXgQOiGzKIjkQN6s0yCy.bzOepNd0S724RYGXeHT8BELCGVAlwK28mFKl9TA9n9rj7W2uGikbHvrmY!/b&bo=gAc4BIAHOAQDCSw!&rf=viewer_4)]
删除目录,变量即可
双击运行即可
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-o6V7eZKd-1626572780966)(http://m.qpic.cn/psc?/V54CA0n72MKGGb0pfLXF4OTqRY0DGvXI/ruAMsa53pVQWN7FLK88i5gTpZ4HiqFFoabaOcM1u8mXbnyPu7eCdM*aeig4jyysFPk4rQK1p4BHN5GLLiid5rJqGlcjup3pjAycjr9QR3Lc!/b&bo=gAc4BIAHOAQDCSw!&rf=viewer_4)]
打开配置文件
apache-tomcat-9.0.31\conf\logging.properties
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Oy79YcDJ-1626572780967)(http://m.qpic.cn/psc?/V54CA0n72MKGGb0pfLXF4OTqRY0DGvXI/45NBuzDIW489QBoVep5mcWSaX8WTGZXM0ucds5KNjRygeSEV54XWL.oaqUoNcyMo4SAqBuW8yr7A0riNBHMNHKLnLOedq3cjxCWJXOivU!/b&bo=gAc4BIAHOAQDWXw!&rf=viewer_4)]
修改配置
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. handlers = 1catalina.org.apache.juli.AsyncFileHandler, 2localhost.org.apache.juli.AsyncFileHandler, 3manager.org.apache.juli.AsyncFileHandler, 4host-manager.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler .handlers = 1catalina.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler ############################################################ # Handler specific properties. # Describes specific configuration info for Handlers. ############################################################ 1catalina.org.apache.juli.AsyncFileHandler.level = FINE 1catalina.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs 1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina. 1catalina.org.apache.juli.AsyncFileHandler.encoding = UTF-8 2localhost.org.apache.juli.AsyncFileHandler.level = FINE 2localhost.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs 2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost. 2localhost.org.apache.juli.AsyncFileHandler.encoding = UTF-8 3manager.org.apache.juli.AsyncFileHandler.level = FINE 3manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs 3manager.org.apache.juli.AsyncFileHandler.prefix = manager. 3manager.org.apache.juli.AsyncFileHandler.encoding = UTF-8 4host-manager.org.apache.juli.AsyncFileHandler.level = FINE 4host-manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs 4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager. 4host-manager.org.apache.juli.AsyncFileHandler.encoding = UTF-8 java.util.logging.ConsoleHandler.level = FINE java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter java.util.logging.ConsoleHandler.encoding = GBK ############################################################ # Facility specific properties. # Provides extra control for each logger. ############################################################ org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.AsyncFileHandler org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.AsyncFileHandler org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.AsyncFileHandler # For example, set the org.apache.catalina.util.LifecycleBase logger to log # each component that extends LifecycleBase changing state: #org.apache.catalina.util.LifecycleBase.level = FINE # To see debug messages in TldLocationsCache, uncomment the following line: #org.apache.jasper.compiler.TldLocationsCache.level = FINE # To see debug messages for HTTP/2 handling, uncomment the following line: #org.apache.coyote.http2.level = FINE # To see debug messages for WebSocket handling, uncomment the following line: #org.apache.tomcat.websocket.level = FINE
没有正确配置JAVA_HOME环境变量
找到占用的端口号,并且找到对应的进程,杀死该进程
netstat -ano
进入conf/server.xml
<Connector port="8888" protocol="HTTP/1.1" onnectionTimeout="20000" redirectPort="8445" />
一般会将tomcat的默认端口号修改为80,80端口号是http协议的默认端口号,在访问时,就不用输入端口号