1 / 15

Chapter 3

Chapter 3. JSP Overview. The Problem with Servlets. processing the request and generating the response are both handled by a single servlet class Java programming knowledge is needed to develop and maintain all aspects of the application

nakia
Download Presentation

Chapter 3

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 3 JSP Overview

  2. The Problem with Servlets • processing the request and generating the response are both handled by a single servlet class • Java programming knowledge is needed to develop and maintain all aspects of the application • Changing the look and feel of the application, or adding support for a new type of client requires the servlet code to be updated and recompiled • It's hard to take advantage of web page development tools when designing the application interface

  3. The Advantage of JSP • separating the request processing and business logic from presentation makes it possible to divide the development tasks among people with different skills

  4. The Anatomy of a JSP Page

  5. JSP Processing • When a JSP page request is processed, the template text and dynamic content generated by the JSP elements are merged, and the result is sent as the response to the browser

  6. JSP Processing • the server needs a JSP container to process JSP pages • The JSP container initiates the translation phase for a page automatically when it receives the first request for the page • turns the JSP page into a servlet • compiles the servlet class • precompilation of a JSP page • request processing phase: invoking the JSP page implementation class • As long as the JSP page remains unchanged, any subsequent request goes straight to the request processing phase • When the JSP page is modified, it goes through the translation phase again • it's loaded once and called repeatedly, until the server is shut down

  7. JSP page translation and processing phases

  8. JSP Elements • Directive • Action • scripting • Expression Language (EL) expression • JavaBeans components

  9. JSP Elements • Directive elements

  10. JSP Elements • Standard action elements

  11. JSP Elements • Custom action elements • The JSP Standard Tag Library (JSTL)

  12. JSP Elements • Scripting elements • allow you to add small pieces of code (typically Java code) in a JSP page

  13. JSP Elements • Expression Language expressions • JavaBeans components • a JavaBeans component is a Java class that complies with certain coding conventions • components are typically used as containers for information that describes application entities, such as a customer or an order

  14. JSP Application Design with MVC • MVC roles in a pure JSP scenario

More Related