Cannot access jakarta.servlet.http.HttpServletResponse
时间: 2024-05-18 18:13:50 浏览: 325
Cannot access jakarta.servlet.http.HttpServletResponse错误提示是由于编译过程中找不到依赖的类javax.servlet.http.HttpServletResponse导致的。
解决这个问题的方法有两种:
1. 将缺失的servlet-api.jar包复制到JDK的目录下。具体步骤是将servlet-api.jar文件复制到${JAVA_HOME}/jre/lib/ext目录下,这样就可以解决依赖问题。
2. 使用赠送的jar包jakarta.servlet-api-4.0.4.jar。该jar包包含了javax.servlet.http.HttpServletResponse类和其他相关的类。你可以将该jar包添加到项目的构建路径中,以解决编译时找不到依赖类的问题。<span class="em">1</span><span class="em">2</span>
#### 引用[.reference_title]
- *1* [无法访问 javax.servlet.http.HttpServletRequest](https://blog.csdn.net/hutudanvip/article/details/43168481)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [jakarta.servlet-api-4.0.4-API文档-中文版.zip](https://download.csdn.net/download/qq_36462452/85332883)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文