JavaWeb-4WebTomcatServlet
JavaWeb-4WebTomcatServlet
1. Web
基本在python开发还有自己学习的过程里,很多内容都明白了

请求数据格式
响应数据格式
2. Web服务器-Tomcat(war包,可能未来Spring的时候就用不到了,那时候是jar包并且集成了http服务器?)

2.1 简介

2.2 下载、安装、卸载、启动、关闭

2.3 配置和部署项目

tomcat有一种python中django的感觉?

通过IDEA插件就能给打包成war包了
2.4 IDEA中创建maven项目
打包就变成右边那样了

2.5 创建maven web项目
2.5.1 使用骨架的方式

2.5.2 不使用骨架的方式

2.6 IDEA中使用Tomcat
2.6.1 继承本地Tomcat


2.6.2 使用Tomcat Maven插件(需要前置Maven Helper插件)

3. Servlet相关(动态相关)

动态资源:不同用户,不一样,有一些逻辑判断(类似flask那种方式?)
3.1 快速入门

实现Servlet接口,复写接口的几个方法
类上使用注解的方式!!!!!!
3.2 执行流程

service方法很关键!

3.3 生命周期(Servlet是由tomcat来创建的)

耗时的操作提前到服务器启动的时候
destroy这块还需要再理解下,结束的时候会被destory,不知道什么用处还
3.4 Servlet方法介绍

提升成员变量作用域

然后在ServletConfig getServletConfig()
中给返回回去就行了
3.5 体系结构——简化Servlet开发


3.6 Servlet urlPattern配置


精确匹配优先级高于目录匹配
default处理静态资源?但是暂时不管前端那边的,后端要设计个好的技术
3.8 XML配置Servlet
还是用注解的方式吧hh

调用模型
4. Request & Response


4.1 Request
4.1.1 继承体系

4.1.2 获取请求数据

- get方法

- post

4.1.3 Request通用方式获取请求参数

get和post都可以这么用,post里面可以this.doGet()


4.1.4 使用Servlet模板创建Servlet更高效

4.1.5 Request请求参数中文乱码处理(POST GET)

4.1.6 请求转发(透传?)


共享数据的理解:

4.2 Response
- 重定向



- 响应
JavaWeb-4WebTomcatServlet
http://example.com/2023/01/08/develop/java/javaweb/JavaWeb-4WebTomcatServlet/