网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
实现转发需要两个步骤,首先在Servlet中要得到RequestDispatcher对象,然后在调用该对象的forward方法实现转发。
参考答案
更多 “实现转发需要两个步骤,首先在Servlet中要得到RequestDispatcher对象,然后在调用该对象的forward方法实现转发。” 相关考题
考题
在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中实现转发功能是通过()方法实现的。
A.response.getRequestDispatcher()B.response.sendRedirect()C.request..getRequestDispatcher()D.request.sendRedirect()
考题
在servlet中实现重定向功能是通过()方法实现的。
A.response.getRequestDispatcher()B.response.sendRedirect()C.request..getRequestDispatcher()D.request.sendRedirect()
考题
当属性scope的值为application时,JSP动作定义的JavaBean实例就会被存储到()对象中。A、Servlet ContextB、Http SessionC、Servlet ApplicationD、Http Servlet Request
考题
Servlet可以通过以下哪个接口实现请求转发机制?()A、HttpServletRequest接口B、RequestDispatcher接口C、HttpServletResponse接口D、ServletConfig接口E、Filter接口
考题
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
考题
在JSP中需要将1.jsp的请求数据通过2.jsp转发给3.jsp,应该在2.jsp中采用()方式实现。A、〈%request.sendRedirect(“3.jsp”)%〉B、〈%response.sendRedirect(“3.jsp”)%〉C、〈%request.getRequestDispatcher(“3.jsp”).forward(request,response)%〉D、〈%response.sentRedirect(“32.jsp”).forward(request,response)%〉
考题
Servlet通过()可以实现请求转发机制。A、HttpServletRequest接口B、RequestDispatcher接口C、HttpServletResponse接口D、ServletConfig接口E、Filter接口
考题
单选题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”))
考题
单选题在JSP中需要将1.jsp的请求数据通过2.jsp转发给3.jsp,应该在2.jsp中采用()方式实现。A
〈%request.sendRedirect(“3.jsp”)%〉B
〈%response.sendRedirect(“3.jsp”)%〉C
〈%request.getRequestDispatcher(“3.jsp”).forward(request,response)%〉D
〈%response.sentRedirect(“32.jsp”).forward(request,response)%〉
考题
单选题Servlet可以通过以下哪个接口实现请求转发机制?()A
HttpServletRequest接口B
RequestDispatcher接口C
HttpServletResponse接口D
ServletConfig接口E
Filter接口
考题
单选题Servlet通过()可以实现请求转发机制。A
HttpServletRequest接口B
RequestDispatcher接口C
HttpServletResponse接口D
ServletConfig接口E
Filter接口
考题
单选题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 receives a request that it forwards to servlet B within another web application in the same webcontainer. Servlet A needs to share data with servlet B and that data must not be visible to other servlets inA’s web application. In which object can the data that A shares with B be stored?()A
HttpSessionB
ServletConfigC
ServletContextD
HttpServletRequestE
HttpServletResponse
考题
单选题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
考题
单选题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
考题
判断题重定向仅仅是将用户定向到其他的JSP页面或Servlet,而不能将Request对象转发给所指向的资源。A
对B
错
热门标签
最新试卷