How to write a while loop in a JSP page?

Following is the while loop example −

<%! int fontSize; %>
      <title>WHILE LOOP Example</title>
      <%while ( fontSize <= 3){ %>
         <font color = "green" size = "<%= fontSize %>">
            JSP Tutorial
         </font><br />

The above code will generate the following result −

JSP Tutorial
JSP Tutorial
JSP Tutorial

Updated on: 30-Jul-2019

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started