欢迎来到天天文库
浏览记录
ID:15589158
大小:72.50 KB
页数:34页
时间:2018-08-04
《jsp复习题2含答案》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、JSP复习题2含答案美斯坦福在线考试系统十堰职院SCCEG2JSP测试科目:SCCEG2JSP总分:100分时间:60分钟一、单选题(共45题,每题2分,说明:选择一项正确的答案)1、下面不属于B/S结构优势的一项是()A、只需要在Web服务器而不是在每一个客户端上部署、修改应用程序B、访问范围更广C、更加容易被访问D、访问速度更快参考答案:D2、HTTP协议中,请求消息使用()方法用于通过Internet发送大量数据。A、getB、postC、putD、head参考答案:B3、浏览Web网页服务默认的端口号是()A、80B、8181C、25D、1
2、433参考答案:A4、假设在helloapp应用中有一个hello.jsp,文件路径为C:/Tomcat/webapps/helloapp/hello/hello.jsp那么在浏览器端访问hello.jsp的URL是()A、http://localhost:8080/hello.jspB、http://localhost:8080/helloapp/hello.jspC、http://localhost:8080/helloapp/hello/hello.jspD、http://localhost:8080/helloapp/hello参考答案:C
3、5、下面不属于Servlet生命周期阶段的是()A、加载B、实例化C、初始化D、请求资源参考答案:D6、在J2EE中,给定某Servlet的代码如下,编译运行该文件,以下陈述正确的是()publicclassServletlextendsHttpServlet{publicvoidinit()throwsServletException{}publicvoidservice(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException
4、{PrintWriterout=response.getWriter();out.println(“hello!”);}}A、编译该文件时会提示缺少doGet()或者doPost()方法,编译不能够成功通过B、编译后,把Servletl.class放在正确位置,运行该Servlet,在浏览器中会看到输出文字:hello!C、编译后,把Servletl.class放在正确位置,运行该Servlet,在浏览器中会看不到任何输出的文字D、编译后,把Servletl.class放在正确位置,运行该Servlet,在浏览器中会看到运行期错误信息参考答案:B7
5、、ServletContext对象的作用是()A、获取请求属性值B、读取请求参数值C、读取Web应用程序上下文参数D、读取Servlet配置参数参考答案:C8、给定如下Servlet代码,假定在浏览器中输入URL:http://localhost:8080/servlet/HelloServlet,可以调用该servlet,那么该Servlet的输出是()importjava.io.*;importjavax.servlet.*;importjavax.servlet.http.*;publicclassHelloServletextendsHtt
6、pServlet{publicvoidservice(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException{}PublicvoiddoGet(HttpServletRequestreq,HttpServletResponseres)ThrowsServletException,IOException{Res.setContentType(“text/html”);PrintWriterout=res.getWriter();Out.printl
7、n(“<html>”);Out.println(“<body>”);Out.println(“doGetHelloWorld”);Out.println(“</body>”);Out.println(</html>);Out.close();}PublicvoiddoPost(HttpServletRequestreq,HttpServletResponseres)ThrowsServletException,IOException{Res.setContentType(“text/html”);PrintWriterout=res.getWrit
8、er();Out.println(“<html>”);Out.println(“<body>”);Out.println(
此文档下载收益归作者所有