j2ee web fundamentals lesson 5 attributes and listeners n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
J2EE Web Fundamentals Lesson 5 Attributes and Listeners PowerPoint Presentation
Download Presentation
J2EE Web Fundamentals Lesson 5 Attributes and Listeners

Loading in 2 Seconds...

play fullscreen
1 / 35

J2EE Web Fundamentals Lesson 5 Attributes and Listeners - PowerPoint PPT Presentation


  • 111 Views
  • Uploaded on

J2EE Web Fundamentals Lesson 5 Attributes and Listeners. Instructor: Dr. Segun Adekile. Outline. Objectives Course Text Book Basham, Bryan; Sierra, Kathy; Bates, Bert (2012-10-30). Head First Servlets and JSP (Kindle Location 1349). O'Reilly Media. Kindle Edition. Attributes and Listeners

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'J2EE Web Fundamentals Lesson 5 Attributes and Listeners' - gitel


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
outline
Outline
  • Objectives
  • Course Text Book
    • Basham, Bryan; Sierra, Kathy; Bates, Bert (2012-10-30). Head First Servlets and JSP (Kindle Location 1349). O'Reilly Media. Kindle Edition.
  • Attributes and Listeners
    • Being a Web App
agenda
Agenda
  • Init Parameters
  • Context Init Parameters
  • ServletConfig VS. ServletContext
  • ServletContextListener
  • The Eight Listeners
  • Attributes
  • Request Dispatching
attribute and thread safety
Attribute and Thread Safety
  • Everyone in the app has access to context attributes, and that means multiple servlets. And multiple servlets means you might have multiple threads, since requests are concurrently handled, each in a separate thread. This happens regardless of whether the requests are coming in for the same or different servlets.
  • Basham, Bryan; Sierra, Kathy; Bates, Bert (2012-10-30). Head First Servlets and JSP (Kindle Locations 4120-4122). O'Reilly Media. Kindle Edition.
attribute and thread safety3
Attribute and Thread Safety
  • Synchronizing the service method is a spectacularly BAD idea
attribute and thread safety4
Attribute and Thread Safety
  • Are Session attributes thread-safe?
request attributes and request dispatching
Request Attributes and Request Dispatching
  • Request attributes make sense when you want some other component of the app to take over all or part of the request.
  • Our typical, simple example is an MVC app that starts with a servlet controller, but ends with a JSP view. The controller communicates with the model, and gets back data that the view needs in order to build the response.
  • There’s no reason to put the data in a context or session attribute, since it applies only to this request, so we put it in the request scope.
request dispatching
Request Dispatching
  • RequestDispatchers have only two methods
    • forward() and include().
  • You can get a RequestDispatcher in two ways:
    • from the request or from the context.
  • Regardless of where you get it, you have to tell it the web component to which you’re forwarding the request. In other words, the servlet or JSP that’ll take over.