题目内容

在HttpServletRequest接口中,getContentType()方法的返回值类型为()

A. int
B. String
C. long
D. double

查看答案
更多问题

在HttpServletRequest接口中,用于获取一个指定头字段的一组值的方法是()

A. getMethod()
B. getHeader(Stringname)
C. getHeaders(Stringname)
D. getHeaderNames(Stringname)

阅读下面代码片段(其中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

答案查题题库