首页 > 解决方案 > 尽管传递了参数的值,但 Java Servlet 中的 request.getParameter 间歇性地变为 null

问题描述

我有2套程序,

第一个程序只是调用 URL ex:http ://sie.corp.abc.com/MyApplication/CreateSi?requestID=202112912

这是每次都使用相同的参数集调用。

在我的 Servlet 中,我将其接收为:

@Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
        String requestId = request.getParameter("requestID");
    }

这里 requestID 有时为空,有时值存在。该应用程序在 JDK 13 的 tomcat8 上运行。

即使在我们有如下内容的 Spring Boot 项目中,这种行为也会产生影响:

protected void noti(@RequestParam(name = "requestID", required = true) String requestID)

这里的 requestID 有时也会为空。

请帮助,因为这会导致我们的应用程序出现很多阻塞。

不确定是否有任何我们可能需要增加的 tomcat 配置或其他东西。但服务器正在继续接收请求。

标签: servletstomcat8java-13

解决方案


推荐阅读