1、修改HTTP header的Location属性进行重定向
//返回301状态码
response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
response.setHeader("Location","http://market.21-sun.com/404.htm");
//返回404状态码
response.setStatus(HttpServletResponse.SC_NOT_FOUND);返回404状态码
request.getRequestDispatcher("/404.htm").forward(request,response);