如果希望用户在访问完Servlet1后可以显示web应用目录下的index.jsp页面,且浏览器地址栏改变为index.jsp,
在Servlet1中如下那种代码可以实现(web应用名为app)?A、response.setHeader("Refresh","0;url=/app/index.jsp...
在Servlet1中如下那种代码可以实现(web应用名为app)?
A、response.setHeader("Refresh","0;url=/app/index.jsp");
B、response.setStatus(302);
response.setHeader("Location","/index.jsp");
C、response.sendRedirect(request.getContextPath()+“/index.jsp”);
D、request.getRequestDispatcher(“/index.jsp”).forward(request,response);
顺便讲下为什么要选择这一项?谢谢 展开
A、response.setHeader("Refresh","0;url=/app/index.jsp");
B、response.setStatus(302);
response.setHeader("Location","/index.jsp");
C、response.sendRedirect(request.getContextPath()+“/index.jsp”);
D、request.getRequestDispatcher(“/index.jsp”).forward(request,response);
顺便讲下为什么要选择这一项?谢谢 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询