Use while loop in jsp code
While loop is a control flow statement that works repeatedly based on a given boolean condition, loop will continuously execute the statements given in the body as long as a given condition is true.
While loop checks the condition before the body execution so this is also called pre test loop. This is the main difference between while and do while loop, do while loop first execute the loop body then checks the boolean condition.
Before run this jsp code create a new directory named "user" in the tomcat-6.0.16/webapps and paste WEB-INF directory in same.
Rum tomcat server by clicking on startup.bat file in bin directory ob tomcat. Save this code as a .jsp file named "while_statement.jsp" in the directory Tomcat-6.0.16/webapps/user/ and you can run this jsp page with following url in address bar of the browser http://localhost:8080/user/while_statement.jsp