OO Programming with Java


Now, web applications can be added with static and/or dynamic content. To proceed, the first thing to do is to define the general structure of an application (called web in the rest of the presentation):

mkdir -p webapps/web/{static,WEB-INF/{classes,lib,tags}}
cd webapps/web

.
├── static
└── WEB-INF
    ├── classes
    ├── lib
    └── tags

2.a. Static parts

Html pages can be put into "static" folder with for instance:

cat > static/index.html <<EOF
<html>
  <head>
    <title>UMS</title>
    <link rel="stylesheet" href="template.css">
  </head>
  <body>
    <h1>Users Management System</h1>
    <ul>
      <li><b>Name - Mark</b></li>
      <li>
      <form action="/Users" method="POST">
        <input name="name"></input>
        <input name="mark"></input>
        <button>add</button>
      </form>
      </li>
    </ul>
  </body>
</html>
EOF

The page is then available at:
http://127.0.0.1:8080/web/static/index.html


4 - 16