Servlet学习中遇到的一些问题及解决

错误:JavaWeb-错误:类xxx不是Servlet

解决:可能是Tomcat版本不匹配导致,更换Tomcat版本解决问题

错误:在自定义的Servlet类中不能添加 @WebServlet 注解

解决:可能是WebServlet版本不匹配,更换版本,3.0以上支持注解

bash 复制代码
<dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.0.1</version>
    </dependency>

输出乱码问题:

选择项目部署的tomcat,在配置项VM options文本框中输入-Dfile.encoding=UTF-8,点击Apply或OK即可。

相关推荐
freewlt14 小时前
OpenClaw 工作流自动化实战:打造你的智能定时任务中心
运维·servlet·自动化
:12115 小时前
Cookie
servlet
zjshuster17 小时前
流程引擎(Process Engine)简介
java·数据库·servlet
xinzheng新政1 天前
Javascript 深入学习基础·4
javascript·学习·servlet
身如柳絮随风扬2 天前
Servlet:访问流程、核心接口与生命周期
java·servlet·web
:1212 天前
请求对象响应对象2
servlet
ruan1145142 天前
关于HashMap--个人学习记录
java·jvm·servlet
凌冰_2 天前
Servlet+Thymeleaf + Fetch 实现无刷新异步请求
java·servlet
椰猫子3 天前
Javaweb(Servlet)
servlet
如若1233 天前
ERROR:pdf2zh.converter:‘str‘ object has no attribute ‘choices‘ converter.py:357
java·开发语言·servlet