Day 13. JavaServer Pages

Yesterday, you looked at developing Web applications using Java servlets. Servlets have the advantage of being able to generate the HTML Web page dynamically. The disadvantage of servlets is the fact that the developer must generate a lot of HTML formatting information from within Java. Servlets can be described as large amounts of boring HTML println() statements interspersed with small amounts of interesting Java code.

Servlets make it difficult to differentiate the presentation layer from the logic layer of an application. This duality of purpose means that servlets do not allow the roles of HTML designer and Java programmer to be easily separated. Writing servlets requires the members of the development team to be either

  • Java programmers who must learn HTML and Web design

  • Web designers who must learn Java

In practice, there are very few Java programmers who make good Web designers, and fewer Web designers who make good Java programmers.

JavaServer Pages are servlets that are written in HTML. Actually, there is a bit more to it than that, but the Java code on a JSP is usually either non-existent or very simple, and can be readily understood by non-Java programmers.

In today's lesson, you will learn

  • What a JSP is and how its implementation differs from servlets

  • The JSP lifecycle—what you have to do and what the Web server will do for you

  • How to deploy a JSP

  • How to use JavaBeans to hide Java functionality from the JSP

  • How to develop a Web application using JSPs

Today's work builds directly on the knowledge gained yesterday because many of the mechanisms used in JSPs are the same as servlets.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.35.193