In your web application,you need to execute a block of code whenever the session object is first created. Which design will accomplish this goal?()A、Create an HttpSessionListener class and implement the sessionInitialized method with that block ofcode.B、Create an HttpSessionActivationListener class and implement the sessionCreated method with thatblock of code.C、Create a Filter class, call the getSession(false) method, and if the result was null, then execute that block of code.D、Create an HttpSessionListener class and implement the sessionCreated method with that block of code.

In your web application,you need to execute a block of code whenever the session object is first created. Which design will accomplish this goal?()

  • A、Create an HttpSessionListener class and implement the sessionInitialized method with that block ofcode.
  • B、Create an HttpSessionActivationListener class and implement the sessionCreated method with thatblock of code.
  • C、Create a Filter class, call the getSession(false) method, and if the result was null, then execute that block of code.
  • D、Create an HttpSessionListener class and implement the sessionCreated method with that block of code.

相关考题:

You create a Web application for your company‘s intranet. You want to enable users to customize their versions of the intranet home page. You create sections of content as Web Parts. You need to ensure that users can customize content at any time.Which two code segments should you use?()A.B.C.D.

You include the calendar class in your Hotel Booking application. Which additional form level objects will you need to create to implement this reusable component fully?()A、Blocks B、Visual attributes. C、Stacked canvas. D、Nothing further needs to be created.

Your web application requires the adding and deleting of many session attributes during a complex usecase. A bug report has come in that indicates that an important session attribute is being deleted too soonand a NullPointerException is being thrown several interactions after the fact. You have decided to create asession event listener that will log when attributes are being deleted so you can track down when theattribute is erroneously being deleted. Which listener class will accomplish this debugging goal?()A、Create an HttpSessionAttributeListener class and implement the attributeDeleted method and log the attribute name using the getName method on the event object.B、Create an HttpSessionAttributeListener class and implement the attributeRemoved method and log the attribute name using the getName method on the event object.C、Create an SessionAttributeListener class and implement the attributeRemoved method and log the attribute name using the getAttributeName method on the event object.D、Create an SessionAttributeListener class and implement the attributeDeleted method and log the attribute name using the getAttributeName method on the event object.

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 have a use case in your web application that adds several session-scoped attributes. At the end of theuse case, one of these objects, the manager attribute, is removed and then it needs to decide which of theother session-scoped attributes to remove. How can this goal be accomplished?()A、The object of the manager attribute should implement the HttpSessionBindingListener and it should call the removeAttribute method on the appropriate session attributes.B、The object of the manager attribute should implement the HttpSessionListener and it should call the removeAttribute method on the appropriate session attributes.C、The object of the manager attribute should implement the HttpSessionBindingListener and it should call the deleteAttribute method on the appropriate session attributes.D、The object of the manager attribute should implement the HttpSessionListener and it should call the deleteAttribute method on the appropriate session attributes.

Your web application uses a simple architecture in which servlets handle requests and then forward to aJSP using a request dispatcher. You need to pass information calculated in the servlet to the JSP for view generation.This information must NOT be accessible to any other servlet,JSP or session in the webapp. Which two techniques can you use to accomplish this goal?()A、Add attributes to the session object.B、Add attributes on the request object.C、Add parameters to the request object.D、Use the pageContext object to add request attributes.E、Add parameters to the JSP’s URL when generating the request dispatcher.

You want to create a filter for your web application and your filter will implement javax.servlet.Filter. Which two statements are true?()A、Your filter class must implement an init method and a destroy method.B、Your filter class must also implement javax.servlet.FilterChain.C、When your filter chains to the next filter, it should pass the same arguments it received in its doFiltermethod.D、The method that your filter invokes on the object it received that implements javax.servlet.FilterChaincan invoke either another filter or a servlet.E、Your filter class must implement a doFilter method that takes, among other things, anHTTPServletRequest object and an HTTPServletResponse object.

A sales analyst reviews the first draft on your Sales application, and requests that the application graphically represent revenue generated for each sales representative, in addition to the textual data currently displayed for the ORDER block. How would you incorporate this graphic in your form? ()A、Invoke the Chart Wizard and create a chart based on the ORDER block. B、Create a chart using Graphics Builder and then select File Import Chart in Form Builder, positioning the new chart with the text items in the ORDER block. C、Invoke the Data Block Wizard in reentrant mode, select the Charts tab, and specify the chart type and column sources for the X and Y axes. D、Select the Chart node in the Object Navigator, Click the Create icon, and specify the details of the chart in the chart's Property Palette.

You are developing an ASP.NET Dynamic Data Web application. Boolean fields must display as Yes or No instead of as a check box. You replace the markup in the default Boolean field template with the following markup.You need to implement the code that displays Yes or No. Which method of the FieldTemplateUserControl class should you override in the BooleanField class?()A、OnLoadB、ConstructC、OnDataBindingD、SaveControlState

You are developing a Web application to display products. Products are displayed on different pages on your Web site. You want to create a user control to manage the display of products. You need a default visual implementation of the UI of the user control. In addition, you need to provide developers with the flexibility to change the layout and controls of the UI. Which three actions should you perform? ()A、Apply the TemplateContainerAttribute to a property of type ITemplate. Pass the type of the template's naming container as the argument to the attribute.B、Apply the TemplateContainerAttribute to the user control's class declaration.C、Implement a property of type INamingContainer in the user control's code-behind class.D、Implement a property of type ITemplate in the user control's code-behind class.E、Define a new class that inherits from the ITemplate interface. Implement the InstantiateIn method of the ITemplate interface.

You are developing a custom-collection class.You need to create a method in your class. You need to ensure that the method you create in your class returns a type that is compatible with the Foreach statement. Which criterion should the method meet?()A、The method must return a type of either IEnumerator or IEnumerable.B、The method must return a type of IComparable.C、The method must explicitly contain a collection.D、The method must be the only iterator in the class.

You are implementing an ASP.NET Web site. The site uses a component that must be dynamically configured before it can be used within site pages. You create a static method named SiteHelper.Configure that configures the component. You need to add a code segment to the Global.asax file that invokes the SiteHelper.Configure method the first time, and only the first time, that any page in the site is requested. Which code segment should you use? ()A、void Application_Start(object sender, EventArgs e) { SiteHelper.Configure(); }B、void Application_Init(object sender, EventArgs e) { SiteHelper.Configure(); }C、void Application_BeginRequest(object sender, EventArgs e) { SiteHelper.Configure(); }D、Object lockObject = new Object(); void Application_BeginRequest(object sender, EventArgs e) { lock(lockObject()) { SiteHelper.Configure(); } }

You are developing a Windows Presentation Foundation (WPF) application.You need to display HTML content from a Web page on the WPF form. What should you do?()A、Add a FlowDocumentReader control to the design surface. Then create a FlowDocument control.B、Add a DocumentViewer control to the design surface. Then create a FixedDocument control.C、Add a WebBrowser control to the design surface. Then use the Navigate method to navigate the URI object.D、Add a ContentControl control to the design surface. Then reference a WebClient object to return an HTML string.

多选题You are developing a Web application to display products. Products are displayed on different pages on your Web site. You want to create a user control to manage the display of products. You need a default visual implementation of the UI of the user control. In addition, you need to provide developers with the flexibility to change the layout and controls of the UI. Which three actions should you perform?()AApply the TemplateContainerAttribute to a property of type ITemplate. Pass the type of the template's naming container as the argument to the attribute.BApply the TemplateContainerAttribute to the user control's class declaration.CImplement a property of type INamingContainer in the user control's code-behind class.DImplement a property of type ITemplate in the user control's code-behind class.EDefine a new class that inherits from the ITemplate interface. Implement the InstantiateIn method of the ITemplate interface.

单选题You include the calendar class in your Hotel Booking application. Which additional form level objects will you need to create to implement this reusable component fully?()ABlocks BVisual attributes. CStacked canvas. DNothing further needs to be created.

多选题You want to create a filter for your web application and your filter will implement javax.servlet.Filter. Which two statements are true?()AYour filter class must implement an init method and a destroy method.BYour filter class must also implement javax.servlet.FilterChain.CWhen your filter chains to the next filter, it should pass the same arguments it received in its doFiltermethod.DThe method that your filter invokes on the object it received that implements javax.servlet.FilterChaincan invoke either another filter or a servlet.EYour filter class must implement a doFilter method that takes, among other things, anHTTPServletRequest object and an HTTPServletResponse object.

单选题You are developing a Windows Presentation Foundation (WPF) application.You need to display HTML content from a Web page on the WPF form. What should you do?()AAdd a FlowDocumentReader control to the design surface. Then create a FlowDocument control.BAdd a DocumentViewer control to the design surface. Then create a FixedDocument control.CAdd a WebBrowser control to the design surface. Then use the Navigate method to navigate the URI object.DAdd a ContentControl control to the design surface. Then reference a WebClient object to return an HTML string.

单选题You work as an application developer at Certkiller .com. Certkiller .com has asked you to create a multi-threaded application, which executes a critical database  backup operation on an hourly basis. You define this operation with the following code:  public void BackupDB () {  //Implementation code }  You then create a Thread object for the purpose of invoking this method.  You need to ensure that the thread is scheduled for execution before any other thread at runtime.What should you do?()A AB BC CD D

单选题You are implementing an ASP.NET Web site. The site uses a component that must be dynamically configured before it can be used within site pages. You create a static method named SiteHelper.Configure that configures the component. You need to add a code segment to the Global.asax file that invokes the SiteHelper.Configure method the first time, and only the first time, that any page in the site is requested. Which code segment should you use? ()Avoid Application_Start(object sender, EventArgs e) { SiteHelper.Configure(); }Bvoid Application_Init(object sender, EventArgs e) { SiteHelper.Configure(); }Cvoid Application_BeginRequest(object sender, EventArgs e) { SiteHelper.Configure(); }DObject lockObject = new Object(); void Application_BeginRequest(object sender, EventArgs e) { lock(lockObject()) { SiteHelper.Configure(); } }

单选题You need to base a data block on the EMP table, but you do not want to give the users of the application access privileges on the table. Which type of data source would you use to create the data block?()Atable Btransactional trigger Cstored procedure DFROM clause query

多选题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 constructor of the JSP’s Java code.DIn a JSP declaration, which includes an initializer block.EIn a JSP declaration, which includes a static initializer block.

单选题You have a use case in your web application that adds several session-scoped attributes. At the end of theuse case, one of these objects, the manager attribute, is removed and then it needs to decide which of theother session-scoped attributes to remove. How can this goal be accomplished?()AThe object of the manager attribute should implement the HttpSessionBindingListener and it should call the removeAttribute method on the appropriate session attributes.BThe object of the manager attribute should implement the HttpSessionListener and it should call the removeAttribute method on the appropriate session attributes.CThe object of the manager attribute should implement the HttpSessionBindingListener and it should call the deleteAttribute method on the appropriate session attributes.DThe object of the manager attribute should implement the HttpSessionListener and it should call the deleteAttribute method on the appropriate session attributes.

单选题You need to create a class definition that is interoperable along with COM.You need to ensure that COM applications can create instances of the class and can call the GetAddress method. Which code segment should you use?()A AB BC CD D

多选题Your web application uses a simple architecture in which servlets handle requests and then forward to aJSP using a request dispatcher. You need to pass information calculated in the servlet to the JSP for view generation.This information must NOT be accessible to any other servlet,JSP or session in the webapp. Which two techniques can you use to accomplish this goal?()AAdd attributes to the session object.BAdd attributes on the request object.CAdd parameters to the request object.DUse the pageContext object to add request attributes.EAdd parameters to the JSP’s URL when generating the request dispatcher.

单选题You are developing a custom-collection class.You need to create a method in your class. You need to ensure that the method you create in your class returns a type that is compatible with the Foreach statement. Which criterion should the method meet?()AThe method must return a type of either IEnumerator or IEnumerable.BThe method must return a type of IComparable.CThe method must explicitly contain a collection.DThe method must be the only iterator in the class.

单选题In your web application,you need to execute a block of code whenever the session object is first created. Which design will accomplish this goal?()ACreate an HttpSessionListener class and implement the sessionInitialized method with that block ofcode.BCreate an HttpSessionActivationListener class and implement the sessionCreated method with thatblock of code.CCreate a Filter class, call the getSession(false) method, and if the result was null, then execute that block of code.DCreate an HttpSessionListener class and implement the sessionCreated method with that block of code.

单选题Your web application requires the adding and deleting of many session attributes during a complex usecase. A bug report has come in that indicates that an important session attribute is being deleted too soonand a NullPointerException is being thrown several interactions after the fact. You have decided to create asession event listener that will log when attributes are being deleted so you can track down when theattribute is erroneously being deleted. Which listener class will accomplish this debugging goal?()ACreate an HttpSessionAttributeListener class and implement the attributeDeleted method and log the attribute name using the getName method on the event object.BCreate an HttpSessionAttributeListener class and implement the attributeRemoved method and log the attribute name using the getName method on the event object.CCreate an SessionAttributeListener class and implement the attributeRemoved method and log the attribute name using the getAttributeName method on the event object.DCreate an SessionAttributeListener class and implement the attributeDeleted method and log the attribute name using the getAttributeName method on the event object.