网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
Given an HttpServlet Request request and Http Servlet Response response, which sets a cookie “username” with the value “joe” in a servlet.?()
A

 request.add Cookie (“username”. “joe”)

B

 request.set Cookie (“username, “joe”)

C

 response.add Cookie (username”, “joe”))

D

 request.add Header (new Cookie (“username”, “joe”))

E

 request.add Cookie (new Cookie (“username”, “joe”))

F

 response.add Cookie (new Cookie (“username”, “joe”))

G

 response.add Header (new Cookie (“username”, “joe”))


参考答案

参考解析
解析: 暂无解析
更多 “单选题Given an HttpServlet Request request and Http Servlet Response response, which sets a cookie “username” with the value “joe” in a servlet.?()A  request.add Cookie (“username”. “joe”)B  request.set Cookie (“username, “joe”)C  response.add Cookie (username”, “joe”))D  request.add Header (new Cookie (“username”, “joe”))E  request.add Cookie (new Cookie (“username”, “joe”))F  response.add Cookie (new Cookie (“username”, “joe”))G  response.add Header (new Cookie (“username”, “joe”))” 相关考题
考题 在J2EE中,在Servlet1中的doGet和doPost方法中只有如下代码:request.setAttribute(jb,aptech);response.sendRedirect(http://localhost:8080/servlet/Servlet2);那么在Servlet2中使用()可以把属性jb的值取出来。 A.Stringstr=request.getAttribute(jb);B.Stringstr=(String)request.getAttribute(jb);C.Objectstr=request.getAttribute(jb);D.取不出来

考题 ServletAforwardedarequesttoservletBusingtheforwardmethodofRequestDispatcher.WhatattributeinB’srequestobjectcontainstheURIoftheoriginalrequestreceivedbyservletA?() A.REQUEST_URIB.javax.servlet.forward.request_uriC.javax.servlet.forward.REQUEST_URID.javax.servlet.request_dispatcher.request_uriE.javax.servlet.request_dispatcher.REQUEST_URI

考题 Servlet的基本架构public class ServletName extends HttpServlet {public void doPost(HttpServletRequest request, HttpServletResponse response) throwsServletException, IOException {}public void doGet(HttpServletRequest request, HttpServletResponse response) throwsServletException, IOException {}}1、用String的方法将数据类型转换为String。

考题 Given a Filter class definition with this method: 21.public void doFilter(ServletRequest request, 22.ServletResponse response, 23.FilterChain chain) 24.throws ServletException, IOException { 25.// insert code here 26.} Which should you insert at line 25 to properly invoke the next filter in the chain, or the target servlet if thereare no more filters?()A、chain.forward(request, response);B、chain.doFilter(request, response);C、request.forward(request, response);D、request.doFilter(request, response);

考题 当属性scope的值为application时,JSP动作定义的JavaBean实例就会被存储到()对象中。A、Servlet ContextB、Http SessionC、Servlet ApplicationD、Http Servlet Request

考题 在Servlet中不能处理客户端POST方式提交的中文乱码的是()A、设置HTTP请求的编码为GB2312B、在接收参数之前输入代码:request.setCharacterEncoding("GB2312");C、设置HTTP请求的编码为GBKD、在接收参数之前输入代码:request.setCharacterEncoding("GBK");E、在接收参数之前输入代码:request.setCharacterEncoding("ISO8859-1")

考题 Servlet A forwarded a request to servlet B using the forward method of RequestDispatcher. What attributein B’s request object contains the URI of the original request received by servlet A?()A、REQUEST_URIB、javax.servlet.forward.request_uriC、javax.servlet.forward.REQUEST_URID、javax.servlet.request_dispatcher.request_uriE、javax.servlet.request_dispatcher.REQUEST_URI

考题 Servlet可通过由容器传递来的Http Servlet Request对象的()方法来获取客户请求的输入参数。A、getParameterB、getProtocolC、getContentTypeD、getAttribute

考题 Django的View中如何取得请求X-App-Code的值?()A、request.META["HTTP_X_APP_CODE"]B、request.HEADERS["X-APP-CODE"]C、request.REQUEST["HTTP_X_APP_CODE"]D、request.REQUEST["X-APP-CODE"]

考题 Given a header in an HTTP request:X-Retries:4 Which two retrieve the value of the header from a given HttpServletRequest request?()A、Request.getHeader("X-Retries")B、Request.getIntHeader("X-Retries")C、Request.getRequestHeader("X-Retries")D、Request.getHeaders("X-Retries").get(0)E、Request.getRequestHeaders("X-Retries").get(0)

考题 下列对HttpServlet类描述错误的是()A、HttpServlet类是针对使用Http协议的Web服务器的Servlet类B、HttpServlet类通过执行Servlet借口,能够提供Http协议的功能C、HttpServlet的子类实现了doGet()方法去响应HTTP的Get请求D、HttpServlet的子类实现了doPost()方法去响应HTTP的Post请求E、HttpServlet类通过init()方法和destory()方法管理Servlet自身的资源

考题 Given an HttpServletRequest request and HttpServletResponse response,which sets a cookie "username"with the value "joe" in a servlet?()A、request.addCookie("username", "joe")B、request.setCookie("username", "joe")C、response.addCookie("username", "joe")D、request.addHeader(new Cookie("username", "joe"))E、request.addCookie(new Cookie("username", "joe"))F、response.addCookie(new Cookie("username", "joe"))

考题 Given this fragment from a Java EE deployment descriptor: 124. beta.html 125. alpha.html And this request from a browser:http://www.sun.com/SCWCDtestApp/register Which statement is correct,when the container receives this request?()A、This deployment descriptor is NOT valid.B、The container first looks in the register directory for beta.html.C、The container first looks in the register directory for alpha.html.D、The container first looks for a servlet mapping in the deployment descriptor.

考题 Given the HttpServlet code:   getServletContext().setAttribute(“foo”, “value”); What is the result?()A、 The attribute foo is placed in the applicationB、 A ServletContextListener registered for that servlet is notifiedC、 A ServletAttributeListener registered for that servlet is notifiedD、 An HttpSessionAttributeListener registered for that servlet is notified

考题 Which retrieves all cookies sent in a given HttpSErvletRequest request?()A、 request.getCookies()B、 request.getAttributes()C、 request.getSession ().getCookies()D、 request.getSession (). GetAttributes()

考题 单选题在Servlet中不能处理客户端POST方式提交的中文乱码的是()A 设置HTTP请求的编码为GB2312B 在接收参数之前输入代码:request.setCharacterEncoding(GB2312);C 设置HTTP请求的编码为GBKD 在接收参数之前输入代码:request.setCharacterEncoding(GBK);E 在接收参数之前输入代码:request.setCharacterEncoding(ISO8859-1)

考题 单选题Given an Http Session session. A Servlet Request request. And a Servlet Context context. Which retrieves a URL to /WEB INF/ my config.xml within a web application?()A  session.get Resource (“/WEB-INF/myconfig.xml”)B  request.get Resource (“/WEB-INF/myconfig.xml”)C  context.get Resource (“/WEB-INF/myconfig.xml”)D  get Class ().get Resource (“/WEB-INF/myconfig.xml”)

考题 单选题A developer has created a special servlet that is responsible for generating XML content that is sent to adata warehousing subsystem. This subsystem uses HTTP to request these large data files, which are compressed by the servlet to save internal network bandwidth. The developer has received a request frommanagement to create several more of these data warehousing servlets. The developer is about to copyand paste the compression code into each new servlet. Which design pattern can consolidate thiscompression code to be used by all of the data warehousing servlets?()A FacadeB View HelperC Transfer ObjectD Intercepting FilterE Composite Facade

考题 单选题Which retrieves all cookies sent in a given HttpSErvletRequest request?()A  request.getCookies()B  request.getAttributes()C  request.getSession ().getCookies()D  request.getSession (). GetAttributes()

考题 单选题Given this fragment from a Java EE deployment descriptor: 124. beta.html 125. alpha.html And this request from a browser:http://www.sun.com/SCWCDtestApp/register Which statement is correct,when the container receives this request?()A This deployment descriptor is NOT valid.B The container first looks in the register directory for beta.html.C The container first looks in the register directory for alpha.html.D The container first looks for a servlet mapping in the deployment descriptor.

考题 单选题Which retrieves the binary input stream on line 13?()A  request.get Writer ():B  request.get Reader ():C  request.get Input Stream():D  request.get Resource As Stream():E  request.get Resource As Stream (Servlet Request. REQUEST):

考题 单选题Servlet A forwarded a request to servlet B using the forward method of RequestDispatcher. What attributein B’s request object contains the URI of the original request received by servlet A?()A REQUEST_URIB javax.servlet.forward.request_uriC javax.servlet.forward.REQUEST_URID javax.servlet.request_dispatcher.request_uriE javax.servlet.request_dispatcher.REQUEST_URI

考题 多选题Given a header in an HTTP request: X-Retries:4  Which two retrieve the value of the header from a given ServletRequest request? ()Arequest.getHeader (“X-Retries”)Brequest.getIntHeader (“X-Retries”)Crequest.getRequestHeader (“x-Retries”)Drequest.getHeaders (“X-Retries”).get (0)Ere request.getRequest Headers (“X-Retries”). Get (0)

考题 单选题Given a Filter class definition with this method: 21.public void doFilter(ServletRequest request, 22.ServletResponse response, 23.FilterChain chain) 24.throws ServletException, IOException { 25.// insert code here26. } Which should you insert at line 25 to properly invoke the next filter in the chain,or the target servlet if thereare no more filters?()A chain.forward(request, response);B chain.doFilter(request, response);C request.forward(request, response);D request.doFilter(request, response);

考题 单选题Your IT department is building a lightweight Front Controller servlet that invokes an application logic objectwith the interface: public interface ApplicationController {public String invoke(HttpServletRequest request)} The return value of this method indicates a symbolic name of the next view. From this name, the FrontController servlet looks up the JSP URL in a configuration table. This URL might be an absolute path or apath relative to the current request. Next, the Front Controller servlet must send the request to this JSP togenerate the view. Assume that the servlet variable request is assigned the current HttpServletRequestobject and the variable context is assigned the webapp’s ServletContext. Which code snippet of the FrontController servlet accomplishes this goal?()A Dispatcher view=context.getDispatcher(viewURL);view.forward Request(request, response);B Dispatcher view=request.getDispatcher(viewURL);view.forward Request(request, response);C RequestDispatcher view. =context.getRequestDispatcher(viewURL);view.forward(request,response);D RequestDispatcher view=request.getRequestDispatcher(viewURL);view.forward(request, response);

考题 单选题在J2EE中,Servlet1的代码如下:  import javax.servlet.*;  import javax.servlet.http.*; import java.io.*;  public class Servlet1 extends HttpServlet {  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {      response.setContentType("text/html");      PrintWriter out = response.getWriter();      String aa=request.getQueryString();      String bb=request.getMethod();      out.println(aa);  out.println(bb);   } }  把Servlet1.class文件放在Web服务器适合的目录下,在浏览B器地址栏内输入:http://localhost:8080/servlet/Servlet1?name=jb-aptechphone=12345678,看到的结果是()。A name=jb-aptechphone=12345678 GETB name=jb-aptech,phone=12345678 GETC jb-aptech,12345678 POSTD name,phone GETE 2,POST

考题 多选题Given a header in an HTTP request:X-Retries:4 Which two retrieve the value of the header from a given HttpServletRequest request?()ARequest.getHeader(X-Retries)BRequest.getIntHeader(X-Retries)CRequest.getRequestHeader(X-Retries)DRequest.getHeaders(X-Retries).get(0)ERequest.getRequestHeaders(X-Retries).get(0)