题目内容

阅读下面代码片段(其中login.jsp页面在webroot目录下):Servlet1:request.setAttribute("company","北京传智播客教育有限公司");RequestDispatcherdispatcher=request.getRequestDispatcher("login.jsp");dispatcher.forward(request,response);login.jsp:hello${company}当使用浏览器访问Servlet1时会什么结果()

A. 页面跳转失败
B. 页面结果显示为:hello${company};
C. 页面跳转错误,程序出现异常;
D. 正常跳转,页面显示为:hello北京传智播客教育有限公司。

查看答案
更多问题

阅读下列的代码publicvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{out.println("hellokity!");}若使Servlet运行的结果为hikitty!,填写在空白处的代码为()则应在此Servlet下划线处添加如下()代码

A. PrintWriterout=response.getWriter();
B. PrintWriteroutrequest.getWriter();
C. OutputStreamout=response.getOutputStream();
D. OutputStreamout=request.getWriter();

HttpServletResponse对象中的getOutputStream()和getWriter()方法同时使用,将产生的异常是()

ArithmeticException
B. IllegalStateException
C. SQLException
D. IOException

如果指定名称的参数存在但没有设置值,则getParameter()方法的返回值是()

A. none
B. “”";i:2;N,"“”
C. .
D.

HttpServletRequest接口中的getDateHeader(Stringname)方法的返回值类型是()

A. int
B. java.util.Date
C. long
D. double

答案查题题库