Problems caused by response.setHeader jumping pages in servlet

        When writing a project, sometimes the content to be displayed in the foreground, such as objects or list containers, is often stored in the request, and the setAttribute method is used, but when the response.setHeader method is used for page jumping, it often occurs on the page after the jump. The value obtained using the request.getAttribute method is null

        This is because the two pages before and after the jump page of setHeader do not use the same request, and the same as this one, the sendRedirect method of the response is also used, so in order to solve this problem, you can use the request's getRequestDispatcher("path name"). forward(request,response); method to jump. The front and back pages of this method share the same request

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326613686&siteId=291194637