单选题You are building a Front Controller using a JSP page and you need to determine if the user’s session hasNOT been created yet and perform some special processing for this case. Which scriptlet code snippet willperform this test?()A <% if ( request.getSe

题目
单选题
You are building a Front Controller using a JSP page and you need to determine if the user’s session hasNOT been created yet and perform some special processing for this case. Which scriptlet code snippet willperform this test?()
A

<% if ( request.getSession(false) == null ) {// special processing} %>

B

<% if ( request.getHttpSession(false) == null ) {// special processing} %>

C

<% if ( requestObject.getSession(false) == null ) { // special processing} %>

D

<% if ( requestObject.getHttpSession(false) == null ) { // special processing} %>


相似考题
参考答案和解析
正确答案: D
解析: 暂无解析
更多“单选题You are building a Front Controller using a JSP page and you need to determine if the user’s session hasNOT been created yet and perform some special processing for this case. Which scriptlet code snippet willperform this test?()A % if ( request.getSes”相关问题
  • 第1题:

    You are creating a new JSP page and you need to execute some code that acts when the page is firstexecuted, but only once. Which three are possible mechanisms for performing this initialization code?()

    • A、In the init method.
    • B、In the jspInit method.
    • C、In the constructor of the JSP’s Java code.
    • D、In a JSP declaration, which includes an initializer block.
    • E、In a JSP declaration, which includes a static initializer block.

    正确答案:B,D,E

  • 第2题:

    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?() <title>

    • A、<jsp:include page=’/WEB-INF/jsp/header.jsp’><jsp:param name=’pageName’ value=’Welcome Page’ /> </jsp:include>
    • B、<jsp:import page=’/WEB-INF/jsp/header.jsp’><jsp:param name=’pageName’ value=’Welcome Page’ /> </jsp:import>
    • C、<jsp:include page=’/WEB-INF/jsp/header.jsp’><jsp:attribute name=’pageName’ value=’Welcome Page’ /> . </jsp:include>
    • D、<jsp:import page=’/WEB-INF/jsp/header.jsp’>. <jsp:attribute name=’pageName’ value=’Welcome Page’ /> . </jsp:import>

    正确答案:A

  • 第3题:

    You are building a Front Controller using a JSP page and you need to determine if the user’s session hasNOT been created yet and perform some special processing for this case. Which scriptlet code snippet willperform this test?()

    • A、<% if ( request.getSession(false) == null ) {// special processing} %>
    • B、<% if ( request.getHttpSession(false) == null ) {// special processing} %>
    • C、<% if ( requestObject.getSession(false) == null ) { // special processing} %>
    • D、<% if ( requestObject.getHttpSession(false) == null ) { // special processing} %>

    正确答案:A

  • 第4题:

    You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.  You create a page that contains the following code fragment.  | English | Chinese | Japan | Korean | - 92 - Test Information Co., Ltd. All rights reserved.   You write the following code segment in the code-behind file for the page.  void BindData(object sender, EventArgs e) {  lstLanguages.DataSource =  CultureInfo.GetCultures(CultureTypes.AllCultures);  lstLanguages.DataTextField = "EnglishName";  lstLanguages.DataBind();  }  You need to ensure that the lstLanguages ListBox control maintains the selection of the user during postback.  Which line of code should you insert in the constructor of the page?()

    • A、this.Init += new EventHandler(BindData); 
    • B、this.PreRender += new EventHandler(BindData); 
    • C、lstLanguages.PreRender += new EventHandler(BindData); 
    • D、lstLanguages.SelectedIndexChanged += new EventHandler(BindData); 

    正确答案:A

  • 第5题:

    单选题
    You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.  You create a page that contains the following code fragment.  | English | Chinese | Japan | Korean | - 92 - Test Information Co., Ltd. All rights reserved.   You write the following code segment in the code-behind file for the page.  void BindData(object sender, EventArgs e) {  lstLanguages.DataSource =  CultureInfo.GetCultures(CultureTypes.AllCultures);  lstLanguages.DataTextField = "EnglishName";  lstLanguages.DataBind();  }  You need to ensure that the lstLanguages ListBox control maintains the selection of the user during postback.  Which line of code should you insert in the constructor of the page?()
    A

    this.Init += new EventHandler(BindData); 

    B

    this.PreRender += new EventHandler(BindData); 

    C

    lstLanguages.PreRender += new EventHandler(BindData); 

    D

    lstLanguages.SelectedIndexChanged += new EventHandler(BindData); 


    正确答案: D
    解析: 暂无解析

  • 第6题:

    单选题
    You create a method that runs by using the credentials of the end user. You need to use  Microsoft Windows groups to authorize the user. You must add a code segment that identifies whether a user is in the local group named Clerk.Which code segment should you use?()
    A

    A

    B

    B

    C

    C

    D

    D


    正确答案: B
    解析: 暂无解析

  • 第7题:

    多选题
    You are developing a Web application. The Web application restricts access to an administrative page. The Web application uses the following code segment to protect the page.if (Page.User.Identity.Name != @"CONTOSO/Administrator") { the page, you are redirected to Login.aspx. You discover that the User.Identity.Name property is not being correctly populated. You need to ensure that you can access the page when you are logged on as Administrator. Which two actions should you perform? ()
    A

    In the Web.config file, enable impersonation.

    B

    In IIS, enable anonymous access.

    C

    In IIS, disable anonymous access.

    D

    In the Web.config file, set the authentication mode to Windows.


    正确答案: C,B
    解析: 暂无解析

  • 第8题:

    多选题
    You are creating a new JSP page and you need to execute some code that acts when the page is firstexecuted, but only once. Which three are possible mechanisms for performing this initialization code?()
    A

    In the init method.

    B

    In the jspInit method.

    C

    In the constructor of the JSP’s Java code.

    D

    In a JSP declaration, which includes an initializer block.

    E

    In a JSP declaration, which includes a static initializer block.


    正确答案: B,C
    解析: 暂无解析

  • 第9题:

    单选题
    You are building JSP pages that have a set of menus that are visible based on a user’s security role. Thesemenus are hand-crafted by your web design team; for example, the SalesManager role has a menu in thefile /WEB-INF/html/sales-mgr-menu.html. Which JSP code snippet should be used to make this menuvisible to the user?()
    A

    <% if ( request.isUserInRole(SalesManager) ) { %> <%@ include file=’/WEB-INF/html/sales-mgr-menu.html’ %> <% } %>

    B

    <jsp:if test=’request.isUserInRole(SalesManager)’> <%@ include file=’/WEB-INF/html/sales-mgr-menu.html’ %> </jsp:if>

    C

    <% if ( request.isUserInRole(SalesManager) ) { %> . <jsp:include file=’/WEB-INF/html/sales-mgr-menu.html’ /> . <% } %>

    D

    <jsp:if test=’request.isUserInRole(SalesManager)’> <jsp:include file=’/WEB-INF/html/sales-mgr-menu.html’ /> </jsp:if>


    正确答案: C
    解析: 暂无解析

  • 第10题:

    单选题
    A JSP page needs to perform some operations before servicing the first request. Where can this be done?()
    A

     within a method called jspInit

    B

     within the page directive of the JSP page

    C

     within a scriptlet at the top of the JSP page

    D

     within the  XML element


    正确答案: B
    解析: 暂无解析

  • 第11题:

    单选题
    You are building a Front Controller using a JSP page and you need to determine if the user’s session hasNOT been created yet and perform some special processing for this case. Which scriptlet code snippet willperform this test?()
    A

    <% if ( request.getSession(false) == null ) {// special processing} %>

    B

    <% if ( request.getHttpSession(false) == null ) {// special processing} %>

    C

    <% if ( requestObject.getSession(false) == null ) { // special processing} %>

    D

    <% if ( requestObject.getHttpSession(false) == null ) { // special processing} %>


    正确答案: A
    解析: 暂无解析

  • 第12题:

    单选题
    You have created a JSP that includes instance variables and a great deal of scriptlet code. Unfortunately,after extensive load testing, you have discovered several race conditions in your JSP scriptlet code. To fixthese problems would require significant recoding, but you are already behind schedule. Which JSP codesnippet can you use to resolve these concurrency problems?()
    A

    <%@ page isThreadSafe=’false’ %>

    B

    <%@ implements SingleThreadModel %>

    C

    <%! implements SingleThreadModel %>

    D

    <%@ page useSingleThreadModel=’true’ %>

    E

    <%@ page implements=’SingleThreadModel’ %>


    正确答案: E
    解析: 暂无解析

  • 第13题:

    You have created a JSP that includes instance variables and a great deal of scriptlet code. Unfortunately,after extensive load testing, you have discovered several race conditions in your JSP scriptlet code. To fixthese problems would require significant recoding, but you are already behind schedule. Which JSP codesnippet can you use to resolve these concurrency problems?()

    • A、<%@ page isThreadSafe=’false’ %>
    • B、<%@ implements SingleThreadModel %>
    • C、<%! implements SingleThreadModel %>
    • D、<%@ page useSingleThreadModel=’true’ %>
    • E、<%@ page implements=’SingleThreadModel’ %>

    正确答案:A

  • 第14题:

    You are building JSP pages that have a set of menus that are visible based on a user’s security role. Thesemenus are hand-crafted by your web design team; for example, the SalesManager role has a menu in thefile /WEB-INF/html/sales-mgr-menu.html. Which JSP code snippet should be used to make this menuvisible to the user?()

    • A、<% if ( request.isUserInRole("SalesManager") ) { %> <%@ include file=’/WEB-INF/html/sales-mgr-menu.html’ %> <% } %>
    • B、<jsp:if test=’request.isUserInRole("SalesManager")’> <%@ include file=’/WEB-INF/html/sales-mgr-menu.html’ %> </jsp:if>
    • C、<% if ( request.isUserInRole("SalesManager") ) { %> . <jsp:include file=’/WEB-INF/html/sales-mgr-menu.html’ /> . <% } %>
    • D、<jsp:if test=’request.isUserInRole("SalesManager")’> <jsp:include file=’/WEB-INF/html/sales-mgr-menu.html’ /> </jsp:if>

    正确答案:A

  • 第15题:

    You are developing a Web application. The Web application restricts access to an administrative page. The Web application uses the following code segment to protect the page.if (Page.User.Identity.Name != @"CONTOSO/Administrator") { the page, you are redirected to Login.aspx. You discover that the User.Identity.Name property is not being correctly populated. You need to ensure that you can access the page when you are logged on as Administrator. Which two actions should you perform? ()

    • A、In the Web.config file, enable impersonation.
    • B、In IIS, enable anonymous access.
    • C、In IIS, disable anonymous access.
    • D、In the Web.config file, set the authentication mode to Windows.

    正确答案:C,D

  • 第16题:

    In your test database, you find that a user’s session is executing a lot of SQL statements, resulting in the generation of a large number of trace files. While investigating the reason, you find that SQL trace has been enabled at the instance level. You want to disable SQL trace, remotely, only for that user session to reduce the volume of trace data being generated.How do you achieve this objective?()

    • A、 by setting the SQL_TRACE parameter to FALSE in the parameter file
    • B、 by using DBMS_MONITOR.SESSION_TRACE_DISABLE to disable the tracing for the user session
    • C、 by setting the SQL_TRACE parameter to FALSE by using the ALTER SYSTEM command in the user session
    • D、 by setting the SQL_TRACE parameter to FALSE by using the ALTER SESSION command in the user session

    正确答案:B

  • 第17题:

    单选题
    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?()
    A

    <jsp:include page=’/WEB-INF/jsp/header.jsp’><jsp:param name=’pageName’ value=’Welcome Page’ /> </jsp:include>

    B

    <jsp:import page=’/WEB-INF/jsp/header.jsp’><jsp:param name=’pageName’ value=’Welcome Page’ /> </jsp:import>

    C

    <jsp:include page=’/WEB-INF/jsp/header.jsp’><jsp:attribute name=’pageName’ value=’Welcome Page’ /> . </jsp:include>

    D

    <jsp:import page=’/WEB-INF/jsp/header.jsp’>. <jsp:attribute name=’pageName’ value=’Welcome Page’ /> . </jsp:import>


    正确答案: A
    解析: 暂无解析

  • 第18题:

    单选题
    You are creating an error page that provides a user-friendly screen whenever a server exception occurs.You want to hide the stack trace, but you do want to provide the exception’s error message to the user sothe user can provide it to the customer service agent at your company.  Which EL code snippet inserts thiserror message into the error page?()
    A

    Message: <b>${exception.message}</b>

    B

    Message: <b>${exception.errorMessage}</b>

    C

    Message: <b>${request.exception.message}</b>

    D

    Message: <b>${pageContext.exception.message}</b>

    E

    Message: <b>${request.exception.errorMessage}</b>


    正确答案: E
    解析: 暂无解析

  • 第19题:

    单选题
    In your test database, you find that a user’s session is executing a lot of SQL statements, resulting in the generation of a large number of trace files. While investigating the reason, you find that SQL trace has been enabled at the instance level.  You want to disable SQL trace, remotely, only for that user session to reduce the volume of trace data being generated.  How do you achieve this objective?()
    A

    by setting the SQL_TRACE parameter to FALSE in the parameter file

    B

    by using DBMS_MONITOR.SESSION_TRACE_DISABLE to disable the tracing for the user session

    C

    by setting the SQL_TRACE parameter to FALSE by using the ALTER SYSTEM command in the user session

    D

    by setting the SQL_TRACE parameter to FALSE by using the ALTER SESSION command in the user session


    正确答案: A
    解析: 暂无解析

  • 第20题:

    单选题
    In a JSP-centric web application, you need to create a catalog browsing JSP page. The catalog is stored asa List object in the catalog attribute of the webapp’s ServletContext object.  Which scriptlet code snippetgives you access to the catalog object?()
    A

    <% List catalog = config.getAttribute(catalog); %>

    B

    <% List catalog = context.getAttribute(catalog); %>

    C

    <% List catalog = application.getAttribute(catalog); %>

    D

    <% List catalog = servletContext.getAttribute(catalog); %>


    正确答案: A
    解析: 暂无解析

  • 第21题:

    单选题
    You create an ASP.NET page named TestPage.aspx that contains validation controls. You need to verify that all input values submitted by the user have been validated by testing the Page.IsValid property. Which page event should you add an event handler to?()
    A

    Init

    B

    Load

    C

    PreInit

    D

    PreLoad


    正确答案: A
    解析: 暂无解析

  • 第22题:

    单选题
    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++; %>


    正确答案: B
    解析: 暂无解析

  • 第23题:

    单选题
    Your web application views all have the same header, which includes the  tag in the  elementof the rendered HTML. You have decided to remove this redundant HTML code from your JSPs and put itinto a single JSP called /WEB-INF/jsp/header.jsp. However, the title of each page is unique, so you havedecided to use a variable called pageTitle to parameterize this in the header JSP, like this: 10.${param.pageTitle} Which JSP code snippet should you use in your main view JSPs to insert the header and pass thepageTitle variable?()
    A

    <jsp:insert page=’/WEB-INF/jsp/header.jsp’>. ${pageTitle=’Welcome Page’}. </jsp:insert>

    B

    <jsp:include page=’/WEB-INF/jsp/header.jsp’>. ${pageTitle=’Welcome Page’}. </jsp:include>

    C

    <jsp:include file=’/WEB-INF/jsp/header.jsp’>. ${pageTitle=’Welcome Page’}. </jsp:include>

    D

    <jsp:insert page=’/WEB-INF/jsp/header.jsp’>. <jsp:param name=’pageTitle’ value=’Welcome Page’ /> . </jsp:insert>

    E

    <jsp:include page=’/WEB-INF/jsp/header.jsp’>. <jsp:param name=’pageTitle’ value=’Welcome Page’ /> . </jsp:include>


    正确答案: A
    解析: 暂无解析

  • 第24题:

    单选题
    For manageability purposes, you have been told to add a "count" instance variable to a critical JSP Document so that a JMX MBean can track how frequent this JSP is being invoked. Which JSP code snippetmust you use to declare this instance variable in the JSP Document?()
    A

    <jsp:declaration>int count = 0;<jsp:declaration>

    B

    <%! int count = 0; %>

    C

    <jsp:declaration.instance>int count = 0;. <jsp:declaration.instance>

    D

    <jsp:scriptlet.declaration>int count = 0;. <jsp:scriptlet.declaration>


    正确答案: C
    解析: 暂无解析