阅读下面代码片段:Servlet1: response.setContentType("text/html;charset=gbk"); response.getWriter().write("传播智慧"); request.getRequestDispatcher("/servlet/Servlet2").forward(request,response); response.sendRedirect("/app/servlet/Servlet3");Servlet2: response.getWriter().write("收获成长");请问当浏览器访问Servlet1时会有什么样的输出
A: 浏览器地址栏仍然保持为Servlet1,输出为“传播智慧收获成长”
B: 浏览器地址栏仍然保持为Servlet1,输出为“收获成长”
C: 浏览器地址栏仍然保持为Servlet1,输出为“传播智慧”
D: 服务器端报错误
A: 浏览器地址栏仍然保持为Servlet1,输出为“传播智慧收获成长”
B: 浏览器地址栏仍然保持为Servlet1,输出为“收获成长”
C: 浏览器地址栏仍然保持为Servlet1,输出为“传播智慧”
D: 服务器端报错误
举一反三
- 阅读下面代码片段: Servlet1: response.setContentType("text/html;charset=gbk"); response.getWriter().write("传播智慧"); request.getRequestDispatcher("/servlet/Servlet2") .forward(request,response); response.sendRedirect("/app/servlet/Servlet3"); Servlet2: response.getWriter().write("收获成长"); 请问当浏览器访问Servlet1时会有什么样的输出
- 阅读下面代码片段: Servlet1: response.setCharacterEncoding("utf-8"); response.setHeader("Content-Type", "text/html;charset=utf-8"); response.getWriter().write("传播"); request.getRequestDispatcher("/servlet/Servlet2") .forward(request,resp onse); Servlet2: response.getWriter().write("智慧"); request.getRequestDispatcher("/servlet/Servlet3") .forward(request,response); response.setHeader("Content-Type", "text/html;charset=iso8859-1"); Servlet3: response.getWriter().write("挥洒汗水"); 请问当浏览器访问Servlet1时会有什么样的输出:
- 阅读下面Servlet1类中的代码片段:Servlet1:response.getOutputStream().write("传智".getBytes("gbk"));response.getWriter().write("播客");request.getRequestDispatcher("/Servlet2").forward(request,response);如果使用浏览器访问Servlet1时会有什么结果() A: 浏览器输出 传智播客 B: 浏览器输出乱码 C: 浏览器输出播客 D: 服务器端报错
- 阅读下面Servlet1类中的代码片段: Servlet1: response.getOutputStream().write("传智".getBytes("gbk")); response.getWriter().write("播客"); request.getRequestDispatcher("/Servlet2").forward(request,response); 如果使用浏览器访问Servlet1时会有什么结果( )
- 阅读下面代码片段:Servlet1:response.setHeader(“Content-Type”,“text/html;charset=utf-8”);response.getOutputStream().write(“疫情”.getBytes(“utf-8”));request.getRequestDispatcher(“/Servlet2”).forward(request,response); Servlet2: response.getOutputStream().write(“防控”.getBytes(“utf-8”));当使用浏览器访问Servlet1时会什么结果 A: 浏览器输出 “疫情防控”均正常无乱码 B: 浏览器输出“疫情”为乱码,输出“防控”正常 C: 浏览器输出“疫情”正常,输出“防控”乱码 D: 浏览器输出“防控”正常