Chapter 3. Branching, Looping, and Creating Methods

Today we're going to get some more essential Java programming under our belts. We'll see three crucial techniques here—branching, looping, and creating methods. These are all basic skills for the JSP programmer, and we'll need them in our programming arsenal throughout the book. Here's an overview of today's topics:

  • Branching statements—. if and switch

  • Looping statements—. for, while, and do-while

  • Creating methods

  • Passing data to methods

  • Returning data from methods

Looping statements—
<HTML> 
  <HEAD>
    <TITLE>Using Logical Operators</TITLE>
  </HEAD>

  <BODY>
    <H1>Using Logical Operators</H1>
    <%
        int temperature = 70;

        if (temperature ...

Get Sams Teach Yourself JavaServer Pages™ in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.