Skip to content

Latest commit

 

History

History
43 lines (38 loc) · 1.35 KB

2021-09-11-jsp-zoo.md

File metadata and controls

43 lines (38 loc) · 1.35 KB
layout title thumbnail tagline sort-key meta-title meta-description meta-image tags previousPost redirect_from discourseEmbedUrl
post
JSP Zoo
/tutorials/java-server/images/jsp-7.png
Use JSP to show a list of animals.
330
JSP Zoo
Use Jakara Server Pages to show a list of animals.
/tutorials/java-server/images/jsp-8.png
example
java
server
jsp
/tutorials/java-server/jsp
/examples/java-server/jsp-zoo
/examples/java-server/jsp-zoo

This example uses JSP to show a list of animals.

<% String[] animals = {
  "lions", "tigers", "bears", "lizards", "zebras",
  "kangaroos", "elephants", "cows", "monkeys", "anteaters"
  }; %>
<!DOCTYPE html>
<html>
  <head>
    <title>JSP Zoo</title>
  </head>
  <body>
    <h1>JSP Zoo</h1>
    <p>Here are the animals we visited at the zoo:</p>
    <% for(int i = 0; i < animals.length; i++){ %>
      <p><%= i+1 %>: <%= animals[i] %></p>
    <% } %>
  </body>
</html>

list of animals