多选题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?()AIn the init method.BIn the jspInit method.CIn the 

题目
多选题
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.


相似考题
更多“多选题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?()AIn the init method.BIn the jspInit method.CIn the ”相关问题
  • 第1题:

    Which three occur during JSP page translation?()

    • A、 The jspInit method is called.
    • B、 The JSP page implementation class is created.
    • C、 The JSP page implementation class is compiled.
    • D、 The JSP page is validated for syntatic correctness.
    • E、 The associated tag files are validated for syntatic correctness.

    正确答案:B,C,D

  • 第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 create a Web Form that allows users to create a new account. You add a CreateUserWizard control by using the following code segment. You need to ensure that the wizard automatically sends an e-mail message to users when they finish creating their accounts. You add a valid element to the Web.config file. Which code segment should you add to the Page_Load event? ()

    • A、Wizard1.RequireEmail = True
    • B、Wizard1.Email = "user@address.com"
    • C、Wizard1.MailDefinition.From = "registration@mysite.com"
    • D、SmtpMail.SmtpServer = "mail.contoso.com"

    正确答案:C

  • 第4题:

    You are creating a custom user control. The custom user control will be used on 10 Web Forms for an ASP.NET Web site that allows users to register and log on to a personalized experience. The custom user control uses two TextBox controls and two Button controls. You need to ensure that the controls are visible only when users are not logged on to the Web site. You also need to minimize the amount of effort in development and maintenance for the Web site. Which two actions should you perform? ()

    • A、Add the OnClick event handler for the Login button to the code used in the custom user control.
    • B、Add the OnClick event handler for the Login button to the code used in the Web Form where the control is added.
    • C、In the Page_Load method of the Web Form, add a code segment to set the visibility of the TextBox and Button controls where the control is added.
    • D、In the Page_Load method of the custom user control, add a code segment to set the visibility of the TextBox and Button controls.

    正确答案:A,D

  • 第5题:

    You create a Web page named TestPage.aspx and a user control named TestUserControl.ascx. TestPage.aspx uses TestUserControl.ascx as shown in the following line of code. On TestUserControl.ascx, you need to add a read-only member named CityName to return the value "New York". You also must add code to TestPage.aspx to read this value. Which two actions should you perform?()

    • A、Add the following line of code to the TestUserControl.ascx.cs code-behind file. public string CityName { get { return "New York"; } } 
    • B、Add the following line of code to the TestUserControl.ascx.cs code-behind file. protected readonly string CityName = "New York"; 
    • C、Add the following code segment to the TestPage.aspx.cs code-behind file. protected void Page_Load(object sender, EventArgs e) { string s = testControl.CityName; } 
    • D、Add the following code segment to the TestPage.aspx.cs code-behind file. protected void Page_Load(object sender, EventArgs e) { string s = testControl.Attributes["CityName"]; } 

    正确答案:A,C

  • 第6题:

    You are developing an ASP.NET Web page. The page includes a List instance. You add a FormView control to display a single Product from this list. You need to bind the list to the FormView control. Which FormView property should you set in the code-behind file?()

    • A、DataSource
    • B、DataSourceID
    • C、DataKeyNames
    • D、DataMember

    正确答案:A

  • 第7题:

    单选题
    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
    解析: 暂无解析

  • 第8题:

    多选题
    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" Then Response.Redirect("login.aspx")End IfYou are logged on as Administrator. When you display 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.


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

  • 第9题:

    多选题
    You create a Web page named TestPage.aspx and a user control named TestUserControl.ascx. TestPage.aspx uses TestUserControl.ascx as shown in the following line of code. On TestUserControl.ascx, you need to add a read-only member named CityName to return the value "New York". You also must add code to TestPage.aspx to read this value. Which two actions should you perform?()
    A

    Add the following line of code to the TestUserControl.ascx.cs code-behind file. public string CityName { get { return New York; } }

    B

    Add the following line of code to the TestUserControl.ascx.cs code-behind file. protected readonly string CityName = New York;

    C

    Add the following code segment to the TestPage.aspx.cs code-behind file. protected void Page_Load(object sender, EventArgs e) { string s = testControl.CityName; }

    D

    Add the following code segment to the TestPage.aspx.cs code-behind file. protected void Page_Load(object sender, EventArgs e) { string s = testControl.Attributes[CityName]; }


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

  • 第10题:

    单选题
    You are testing an existing ASP.NET page. The page includes a text box. You are able to execute malicious JavaScript code by typing it in the text box and submitting. You need to configure the page to prevent JavaScript code from being submitted by the text box. In the @ Page directive, which attribute should you set to true?()
    A

    the EnableEventValidation attribute

    B

    the ResponseEncoding attribute

    C

    the ValidateRequest attribute

    D

    the Strict attribute


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

  • 第11题:

    多选题
    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

    Id

    B

    Val

    C

    Name

    D

    Param

    E

    Value

    F

    Property


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

  • 第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 developing an inventory report to list the item number, description price and picture of all inventory items. The layout of each item is a repeating frame that contains three fixed fields and a image. When possible you want all objects in the repeating frame to appear on the same logical page without creating blank pages between instances. Which pagination property would you alter to achieve these results?()

    • A、Page break before. 
    • B、Page break after. 
    • C、Page protect. 
    • D、Keep with anchoring object.

    正确答案:C

  • 第15题:

    You are creating an ASP.NET Web site. The site has a master page named Custom.master. The code-behind file for Custom.master contains the following code segment.Partial Public Class Custom  Inherits System.Web.UI.MasterPagePublic Property Region As String    Protected Sub Page_Load(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.LoadEnd SubEnd Class You create a new ASP.NET page and specify Custom.master as its master page.You add a Label control named lblRegion to the new page.  You need to display the value of the master pages Region property in lblRegion.What should you do? ()

    • A、Add the following code segment to the Page_Load method of the page code-behind file. Dim custom As Custom = Me.Parent  lblRegion.Text = custom.Region
    • B、Add the following code segment to the Page_Load method of the page code-behind file. Dim custom As Custom = Me.Master  lblRegion.Text = custom.Region
    • C、Add the following code segment to the Page_Load method of the Custom.Master.vb code-behind file. Dim lblRegion As Label = Page.FindControl("lblRegion") lblRegion.Text = Me.Region
    • D、Add the following code segment to the Page_Load method of the Custom.Master.vb code-behind file. Dim lblRegion As Label = Master.FindControl("lblRegion") lblRegion.Text = Me.Region

    正确答案:B

  • 第16题:

    You are testing an existing ASP.NET page. The page includes a text box. You are able to execute malicious JavaScript code by typing it in the text box and submitting. You need to configure the page to prevent JavaScript code from being submitted by the text box. In the @ Page directive, which attribute should you set to true?()

    • A、the EnableEventValidation attribute
    • B、the ResponseEncoding attribute
    • C、the ValidateRequest attribute
    • D、the Strict attribute

    正确答案:C

  • 第17题:

    You are creating an undo buffer that stores data modifications.You need to ensure that the undo functionality undoes the most recent data modifications first.You also need to ensure that the undo buffer permits the storage of strings only.Which code segment should you use?()

    • A、Stack<string> undoBuffer=new Stack<string>();
    • B、Stack undoBuffer=new Stack();
    • C、Queue<string> undoBuffer=new Queue<string>();
    • D、Queue undoBuffer=new Queue();

    正确答案:A

  • 第18题:

    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

  • 第19题:

    多选题
    Which three occur during JSP page translation?()
    A

    The jspInit method is called.

    B

    The JSP page implementation class is created.

    C

    The JSP page implementation class is compiled.

    D

    The JSP page is validated for syntatic correctness.

    E

    The associated tag files are validated for syntatic correctness.


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

  • 第20题:

    多选题
    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
    解析: 暂无解析

  • 第21题:

    多选题
    You are creating a custom user control. The custom user control will be used on 10 Web Forms for an ASP.NET Web site that allows users to register and log on to a personalized experience.The custom user control uses two TextBox controls and two Button controls.You need to ensure that the controls are visible only when users are not logged on to the Web site. You also need to minimize the amount of effort in development and maintenance for the Web site. Which two actions should you perform?()
    A

    Add the OnClick event handler for the Login button to the code used in the custom user control.

    B

    Add the OnClick event handler for the Login button to the code used in the Web Form where the control is added.

    C

    In the Page_Load method of the Web Form, add a code segment to set the visibility of the TextBox and Button controls where the control is added.

    D

    In the Page_Load method of the custom user control, add a code segment to set the visibility of the TextBox and Button controls.


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

  • 第22题:

    单选题
    You create a Web Form that allows users to create a new account. You add a CreateUserWizard control by using the following code segment.You need to ensure that the wizard automatically sends an e-mail message to users when they finish creating their accounts. You add a valid element to the Web.config file. Which code segment should you add to the Page_Load event?()
    A

     Wizard1.RequireEmail = True

    B

     Wizard1.Email = user@address.com

    C

     Wizard1.MailDefinition.From = registration@mysite.com

    D

     SmtpMail.SmtpServer = mail.contoso.com


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

  • 第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
    解析: 暂无解析