O'Reilly logo

Java All-in-One For Dummies, 4th Edition by Doug Lowe

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3

Using JavaServer Pages

In This Chapter

arrow Seeing how servlets work

arrow Dealing with page directives

arrow Trying out expressions

arrow Putting scriptlets to work

arrow Devising declarations

arrow Comprehending classes

In Book VII, Chapter 2, you discover how to create servlets that write HTML data directly to a page by using the PrintWriter object accessed through response.out. Although this technique works, it has one major drawback: You have to compose the HTML manually as a bunch of string literals. If the HTML has an error, you don’t know about it until you run the servlet to see how it looks. Also, handcrafting HTML in out.println statements certainly isn’t the most efficient way to create attractive web pages.

That’s where JavaServer Pages (a technology usually called JSP for short) comes in. A JavaServer Page is an HTML file that has Java servlet code embed- ded in it in special tags. When you ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required