300 likes | 400 Vues
Dive into Java Server Pages (JSP) with this comprehensive lesson covering objectives, elements, expressions, implicit objects, standard actions, JSTL, and custom tag development. Understand why JSPs are essential in web development and how they function as servlets. Explore the lifecycle of a JSP and learn to initialize attributes. Unleash the power of JSP Expression Language for dynamic content creation.
E N D
J2EE Web FundamentalsLesson 7JSP Instructor: Dr. SegunAdekile
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. • Using JSP: • Being a JSP
Agenda • Introduction • Why JSPs? • What is a JSP? • Page Directive • JSP Element: Expressions • JSP Element: Declarations • Implicit Objects • Comments • Standard Actions • Expression Language • JSTL • Custom Tag Development
What is a JSP? • A JSP is a servlet
What is a JSP? • In the end, a JSP is just a servlet • Your JSP eventually becomes a full-fledged servlet running in your web app. • It’s a lot like any other servlet, except that the servlet class is written for you — by the Container. • The Container takes what you’ve written in your JSP, translates it into a servlet class source (. java) file, then compiles that into a Java servlet class. • After that, it’s just servlets all the way down, and the servlet runs in exactly the same way it would if you’d written and compiled the code yourself. • In other words, the Container loads the servlet class, instantiates and initializes it, makes a separate thread for each request, and calls the servlet’s service() method.