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

题目内容 (请给出正确答案)

Given the JSP code: <% request.setAttribute("foo", "bar"); %>and the Classic tag handler code: 5. public int doStartTag() throws JspException { 6. // insert code here 7. // return int 8. } Assume there are no other "foo" attributes in the web application. Which invocation on the pageContextobject,inserted at line 6,assigns "bar" to the variable x?()

  • A、String x = (String) pageContext.getAttribute("foo")
  • B、String x = (String) pageContext.getRequestScope("foo")
  • C、It is NOT possible to access the pageContext object from within doStartTag
  • D、String x = (String) pageContext.getRequest().getAttribute("foo")
  • E、String x = (String) pageContext.getAttribute("foo", PageContext.ANY_SCOPE)

参考答案

更多 “ Given the JSP code: % request.setAttribute("foo", "bar"); %and the Classic tag handler code: 5. public int doStartTag() throws JspException { 6. // insert code here 7. // return int 8. } Assume there are no other "foo" attributes in the web application. Which invocation on the pageContextobject,inserted at line 6,assigns "bar" to the variable x?()A、String x = (String) pageContext.getAttribute("foo")B、String x = (String) pageContext.getRequestScope("foo")C、It is NOT possible to access the pageContext object from within doStartTagD、String x = (String) pageContext.getRequest().getAttribute("foo")E、String x = (String) pageContext.getAttribute("foo", PageContext.ANY_SCOPE)” 相关考题
考题 在J2EE中,在aa.jsp中有行代码:%request.setAttribute(Co.,jb-aptech%request.setAttribute(Co.,jb-aptech);%在bb.jsp中有行代码:%out.println((String)request.getAttribute(Co.));%为了使得在bb.jsp中的如上代码可以显示jb-aptech”,可以使用()方法。A.在aa.jsp中使用formmethod=postaction=bb.jsp把请求提交到bb.jspB.在aa.jsp中使用jsp:forwardfile=bb.jsp/把页面重定向到bb.jspC.在aa.jsp中使用%response.sendRedirect(bb.jsp);%把页面重定向到bb.jspD.在aa.jsp中使用%@includefile=bb.jsp%包含页面bb.jspE.在aa.jsp中使用%config.getServletContext().getRequestDispatcher(/bb.jsp).forward(request,response);%把页面重定向到bb.jsp

考题 JSP EL表达式的语法为( )A、!JSP expressionB、@{JSP expression}C、${JSP expression}D、#{JSP expression}

考题 Youarebuildingyourownlayoutmechanismbyincludingdynamiccontentforthepage’sheaderandfootersections.Thefooterisalwaysstatic,buttheheadergeneratesthetitletagthatrequiresthepagenametobespecifieddynamicallywhentheheaderisimported.WhichJSPcodesnippetperformstheimportoftheheadercontent?()A.jsp:includepage=’/WEB-INF/jsp/header.jsp’jsp:paramname=’pageName’value=’WelcomePage’//jsp:includeB.jsp:importpage=’/WEB-INF/jsp/header.jsp’jsp:paramname=’pageName’value=’WelcomePage’//jsp:importC.jsp:includepage=’/WEB-INF/jsp/header.jsp’jsp:attributename=’pageName’value=’WelcomePage’/./jsp:includeD.jsp:importpage=’/WEB-INF/jsp/header.jsp’.jsp:attributename=’pageName’value=’WelcomePage’/./jsp:import

考题 Whichtwoarevalidandequivalent?() A.%!inti;%B.%=inti;%C.jsp:exprinti;/jsp:exprD.jsp:scriptletinti;/jsp:scriptletE.jsp:declarationinti;/jsp:declaration

考题 Given:11.servlet12.servlet-namecatalog/servlet-name13.jsp-file/catalogTemplate.jsp/jsp-file14.load-on-startup10/load-on-startup15./servletWhichtwoaretrue?()A.Line13isnotvalidforaservletdeclaration.B.Line14isnotvalidforaservletdeclaration.C.Oneinstanceoftheservletwillbeloadedatstartup.D.Teninstancesoftheservletwillbeloadedatstartup.E.Theservletwillbereferencedbythenamecataloginmappings.

考题 WhichJSPstandardactioncanbeusedtoimportcontentfromaresourcecalledfoo.jsp?() A.jsp:importfile=’foo.jsp’/B.jsp:importpage=’foo.jsp’/C.jsp:includepage=’foo.jsp’/D.jsp:includefile=’foo.jsp’/

考题 在J2EE中,在aa.jsp中有行代码:  %%  request.setAttribute("Co.","jb-aptech");  %  在bb.jsp中有行代码: %  out.println((String)request.getAttribute("Co."));  %    %   为了使得在bb.jsp中的如上代码可以显示“jb-aptech”,可以使用()方法。A、在aa.jsp中使用form method=post action="bb.jsp"把请求提交到bb.jsp B、在aa.jsp中使用jsp:forward file="bb.jsp" /把页面重定向到bb.jsp  C、在aa.jsp中使用%  response.sendRedirect("bb.jsp");  %把页面重定向到bb.jsp D、在aa.jsp中使用%@ include file="bb.jsp" %包含页面bb.jsp  E、在aa.jsp中使用% config.getServletContext().getRequestDispatcher("/bb.jsp").forward(request,response); %把页面重定向到bb.jsp

考题 Given a JSP error page, which implicit object refers to the uncaught Throwable that resulted in th epage being invoked?()A、 ErrorB、 ExceptionC、 ThrowableD、 Request errorE、 Request exception

考题 Given the element from the web application deployment descriptor: /main/page1.jsp true and given that /main/page1.jsp contains: % int i = 12; % %= i %  What is the result?()A、b/bB、b12/bC、The JSP fails to execute.D、% int i = 12 %b%= i %/b

考题 Which JSP standard action can be used to import content from a resource called foo.jsp?()A、jsp:import file=’foo.jsp’ /B、jsp:import page=’foo.jsp’ /C、jsp:include page=’foo.jsp’ /D、jsp:include file=’foo.jsp’ /

考题 JSP标准动作不包括()。 A、jsp:forward / B、jsp:forEach / C、jsp:useBean / D、jsp:setProperry / 

考题 JSP页面包括以下哪些元素?()A、JSP指令B、JSP ActionC、JSP脚本D、JSP控件

考题 You are building your own layout mechanism by including dynamic content for the page’s header and footersections. The footer is always static, but the header generates the  tag that requires the page name tobe specified dynamically when the header is imported. Which JSP code snippet performs the import of theheader content?() titleA、jsp:include page=’/WEB-INF/jsp/header.jsp’jsp:param name=’pageName’ value=’Welcome Page’ / /jsp:includeB、jsp:import page=’/WEB-INF/jsp/header.jsp’jsp:param name=’pageName’ value=’Welcome Page’ / /jsp:importC、jsp:include page=’/WEB-INF/jsp/header.jsp’jsp:attribute name=’pageName’ value=’Welcome Page’ / . /jsp:includeD、jsp:import page=’/WEB-INF/jsp/header.jsp’. jsp:attribute name=’pageName’ value=’Welcome Page’ / . /jsp:import

考题 Given this fragment from a Java EE deployment descriptor: 341. 342.java.lang.Throwable  343./mainError.jsp 344. 345. 346.java.lang.ClassCastException  347./castError.jsp 348. If the web application associated with the fragment above throws a ClassCastException.Which statement is true?()A、The deployment descriptor is invalid.B、The container invokes mainError.jsp.C、The container invokes castError.jsp.D、Neither mainError.jsp nor castError.jsp is invoked.

考题 Which two are valid and equivalent?()A、%! int i; %B、%= int i; %C、jsp:exprint i;/jsp:exprD、jsp:scriptletint i;/jsp:scriptletE、jsp:declarationint i;/jsp:declaration

考题 A JSP page needs to set the property of a given JavaBean to a value that is calculated with the JSP page. Which three jsp:setProperty attributes must be used to perform this initialization?()A、IdB、ValC、NameD、ParamE、ValueF、Property

考题 Given the JSP code: 10. 11. 12. 13.Hello, ${customer.title} ${customer.lastName}, welcome 14.to Squeaky Beans, Inc. 15.16.  Which three types of JSP code are used?()A、Java codeB、Template textC、Scripting codeD、Standard actionE、Expression language

考题 多选题Given the JSP code: 10. 11. 12. 13.Hello, ${customer.title} ${customer.lastName}, welcome 14.to Squeaky Beans, Inc. 15.16.  Which three types of JSP code are used?()AJava codeBTemplate textCScripting codeDStandard actionEExpression language

考题 单选题For debugging purposes, you need to record how many times a given JSP is invoked before the user’ssession has been created. The JSP’s destroy method stores this information to a database. Which JSPcode snippet keeps track of this count for the lifetime of the JSP page?()A %! int count = 0; %% if ( request.getSession(false) == null ) count++; %B %@ int count = 0; %. % if ( request.getSession(false) == null ) count++; %C % int count = 0;. if ( request.getSession(false) == null ) count++; %D %@ int count = 0;. if ( request.getSession(false) == null ) count++; %E %! int count = 0;. if ( request.getSession(false) == null ) count++; %

考题 多选题Given the JSP code: 10. 11. 12. 13.Hello, ${customer.title} ${customer.lastName}, welcome 14.to Squeaky Beans, Inc. 15.16.  Which three types of JSP code are used?()AJava codeBTemplate textCScripting codeDStandard actionEExpression language

考题 单选题Given the element from the web application deployment descriptor: /main/page1.jsp true and given that /main/page1.jsp contains:   What is the result?()A b/bB b12/bC The JSP fails to execute.D % int i = 12 %b%= i %/b

考题 单选题A session-scoped attribute, product, is stored by a servlet. That servlet then forwards to a JSP page. This attribute holds an instance of the com.Company.   Product class with a name property of “The Matrix” and price property of 39.95. Given the JSP page code snippet: What is the response output of this JSP page code snippet? ()A  Default costs 0.0B  Default costs 49.95C  Default costs 39.95D  The Matrix costs 0.0E  The Matrix costs 49.95F  The Matrix costs 39.95

考题 单选题Given a JSP error page, which implicit object refers to the uncaught Throwable that resulted in th epage being invoked?()A  ErrorB  ExceptionC  ThrowableD  Request errorE  Request exception

考题 单选题Given the element from the web application deployment descriptor: /main/page1.jsp true and given that /main/page1.jsp contains:   What is the result?()A b/bB b12/bC The JSP fails to execute.D % int i = 12 %b%= i %/b

考题 单选题Given that login.getName() returns a java.lang.String value and given the JSP code:  Welcome Which is equivalent?()A % Welcome % out.print(login.getName()); % B  Welcome % writer.print(login.getName()); % C  Welcome % response.out.print(login.getName()); %D  Welcome % response.writer.print(login.getName()); % E  Welcome % response.getOutputStream().write(login.getName()); %

考题 多选题A JSP page needs to set the property of a given JavaBean to a value that is calculated with the JSP page. Which three jsp:setProperty attributes must be used to perform this initialization?()AIdBValCNameDParamEValueFProperty

考题 单选题Given this fragment from a Java EE deployment descriptor: 341. 342.java.lang.Throwable  343./mainError.jsp 344. 345. 346.java.lang.ClassCastException  347./castError.jsp 348. If the web application associated with the fragment above throws a ClassCastException.Which statement is true?()A The deployment descriptor is invalid.B The container invokes mainError.jsp.C The container invokes castError.jsp.D Neither mainError.jsp nor castError.jsp is invoked.

考题 单选题Given this fragment from a Java EE deployment descriptor: 341. 342.java.lang.Throwable  343./mainError.jsp 344. 345. 346.java.lang.ClassCastException  347./castError.jsp 348. If the web application associated with the fragment above throws a ClassCastException.Which statement is true?()A The deployment descriptor is invalid.B The container invokes mainError.jsp.C The container invokes castError.jsp.D Neither mainError.jsp nor castError.jsp is invoked.